request = $request; parent::__construct($metadata); } /** * {@inheritdoc} */ public function getSecure() { $this->updateSecureValue(); return $this->get(self::KEY_SECURE); } /** * {@inheritdoc} */ public function __toArray() { $this->updateSecureValue(); return parent::__toArray(); } /** * Update secure value, set it to request setting if it has no explicit value assigned. * * @return void */ private function updateSecureValue() { if (null === $this->get(self::KEY_SECURE)) { $this->set(self::KEY_SECURE, $this->request->isSecure()); } } }