1 | <?php |
||
35 | class SessionContainer implements \Countable, \IteratorAggregate{ |
||
36 | |||
37 | /** @var string */ |
||
38 | protected $sessionNamespace; |
||
39 | |||
40 | /** |
||
41 | * Class constructor. |
||
42 | * @param string $sessionNamespace the namespace to use |
||
43 | */ |
||
44 | 1 | public function __construct($sessionNamespace) { |
|
48 | |||
49 | /** |
||
50 | * Checks if the session property is available. |
||
51 | * @param string $property the property to check in the session |
||
52 | * @throws \InvalidArgumentException |
||
53 | * @return boolean check result |
||
54 | */ |
||
55 | 1 | public function contains($property) { |
|
59 | |||
60 | /** |
||
61 | * Returns the session property hold content or the default value. |
||
62 | * @param string $property the session property to retrieve the content from |
||
63 | * @param mixed $defaultValue the default value if the property des not exist |
||
64 | * @throws \InvalidArgumentException |
||
65 | * @return mixed the property hold content or the default value if the property does not exist |
||
66 | */ |
||
67 | 1 | public function get($property, $defaultValue = null) { |
|
76 | |||
77 | /** |
||
78 | * Sets the session property and assigns the content to it. |
||
79 | * @param string $property the property to assign the content to |
||
80 | * @param mixed $value the value to store |
||
81 | * @throws \InvalidArgumentException |
||
82 | * @return \Brickoo\Component\Session\SessionContainer |
||
83 | */ |
||
84 | 1 | public function set($property, $value) { |
|
89 | |||
90 | /** |
||
91 | * Removes the session property if available. |
||
92 | * @param string $property the property to remove |
||
93 | * @throws \InvalidArgumentException |
||
94 | * @return \Brickoo\Component\Session\SessionContainer |
||
95 | */ |
||
96 | 1 | public function remove($property) { |
|
105 | |||
106 | /** |
||
107 | * Retrieve an external iterator |
||
108 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
109 | * @return \ArrayIterator |
||
110 | */ |
||
111 | 1 | public function getIterator() { |
|
114 | |||
115 | /** |
||
116 | * Count entries of the container |
||
117 | * @link http://php.net/manual/en/countable.count.php |
||
118 | * @return integer count of entries |
||
119 | */ |
||
120 | 1 | public function count() { |
|
123 | |||
124 | /** |
||
125 | * Returns the property namespace name. |
||
126 | * @param string $property the property to modify |
||
127 | * @return string the session namespace of the property |
||
128 | */ |
||
129 | 4 | private function getNamespace($property) { |
|
132 | } |
||
133 |