Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Storage.php
Go to the documentation of this file.
1 <?php
9 
11 {
17  protected $namespace;
18 
25  public function __construct($namespace = 'default', array $data = [])
26  {
27  $this->namespace = $namespace;
28  parent::__construct($data);
29  }
30 
34  public function init(array $data)
35  {
36  $namespace = $this->getNamespace();
37  if (isset($data[$namespace])) {
38  $this->setData($data[$namespace]);
39  }
40  $_SESSION[$namespace] = & $this->_data;
41  }
42 
46  public function getNamespace()
47  {
48  return $this->namespace;
49  }
50 
58  public function getData($key = '', $clear = false)
59  {
60  $data = parent::getData($key);
61  if ($clear && isset($this->_data[$key])) {
62  unset($this->_data[$key]);
63  }
64  return $data;
65  }
66 }
__construct($namespace='default', array $data=[])
Definition: Storage.php:25
getData($key='', $clear=false)
Definition: Storage.php:58
setData($key, $value=null)
Definition: DataObject.php:72