Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CookieMetadata.php
Go to the documentation of this file.
1 <?php
7 
14 {
18  const KEY_DOMAIN = 'domain';
19  const KEY_PATH = 'path';
20  const KEY_SECURE = 'secure';
21  const KEY_HTTP_ONLY = 'http_only';
22  const KEY_DURATION = 'duration';
26  private $metadata;
27 
31  public function __construct($metadata = [])
32  {
33  if (!is_array($metadata)) {
34  $metadata = [];
35  }
36  $this->metadata = $metadata;
37  }
38 
46  public function __toArray()
47  {
48  return $this->metadata;
49  }
50 
57  public function setDomain($domain)
58  {
59  return $this->set(self::KEY_DOMAIN, $domain);
60  }
61 
67  public function getDomain()
68  {
69  return $this->get(self::KEY_DOMAIN);
70  }
71 
78  public function setPath($path)
79  {
80  return $this->set(self::KEY_PATH, $path);
81  }
82 
88  public function getPath()
89  {
90  return $this->get(self::KEY_PATH);
91  }
92 
99  protected function get($name)
100  {
101  if (isset($this->metadata[$name])) {
102  return $this->metadata[$name];
103  }
104  return null;
105  }
106 
114  protected function set($name, $value)
115  {
116  $this->metadata[$name] = $value;
117  return $this;
118  }
119 
125  public function getHttpOnly()
126  {
127  return $this->get(self::KEY_HTTP_ONLY);
128  }
129 
135  public function getSecure()
136  {
137  return $this->get(self::KEY_SECURE);
138  }
139 }
$value
Definition: gender.phtml:16
if(!isset($_GET['name'])) $name
Definition: log.php:14