![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Stdlib/Cookie/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Stdlib\Cookie; use Magento\Framework\App\RequestInterface; /** * Sensitive Cookie Attributes * * The class has only methods extended from CookieMetadata * as path and domain are only data to be exposed by SensitiveCookieMetadata * * @api * @since 100.0.2 */ class SensitiveCookieMetadata extends CookieMetadata { /** * @var RequestInterface */ protected $request; /** * @param RequestInterface $request * @param array $metadata */ public function __construct(RequestInterface $request, $metadata = []) { if (!isset($metadata[self::KEY_HTTP_ONLY])) { $metadata[self::KEY_HTTP_ONLY] = true; } if (!isset($metadata[self::KEY_SAME_SITE])) { $metadata[self::KEY_SAME_SITE] = 'Lax'; } $this->request = $request; parent::__construct($metadata); } /** * @inheritdoc */ public function getSecure() { $this->updateSecureValue(); return $this->get(self::KEY_SECURE); } /** * @inheritdoc */ public function __toArray() //phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames { $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()); } } }