![]() 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/View/Element/Js/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\View\Element\Js; use Magento\Framework\Session\Config\ConfigInterface; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; /** * Block passes configuration for cookies set by JS * * @api * @since 100.0.2 */ class Cookie extends Template { /** * Session config * * @var ConfigInterface */ protected $sessionConfig; /** * @var \Magento\Framework\Validator\Ip */ protected $ipValidator; /** * Constructor * * @param Context $context * @param ConfigInterface $cookieConfig * @param \Magento\Framework\Validator\Ip $ipValidator * @param array $data */ public function __construct( Context $context, ConfigInterface $cookieConfig, \Magento\Framework\Validator\Ip $ipValidator, array $data = [] ) { $this->sessionConfig = $cookieConfig; $this->ipValidator = $ipValidator; parent::__construct($context, $data); } /** * Get configured cookie domain * * @return string */ public function getDomain() { $domain = $this->sessionConfig->getCookieDomain(); if ($this->ipValidator->isValid($domain)) { return $domain; } if (!empty($domain[0]) && $domain[0] !== '.') { $domain = '.' . $domain; } return $domain; } /** * Get configured cookie path * * @return string */ public function getPath() { return $this->sessionConfig->getCookiePath(); } /** * Get configured cookie lifetime * * @return int */ public function getLifetime() { return $this->sessionConfig->getCookieLifetime(); } }