@@ -16,7 +16,12 @@ class MixedStore implements \ArrayAccess
1616 /**
1717 * @var array
1818 */
19- private $ scalarStore ;
19+ private $ standardStore ;
20+
21+ /**
22+ * @var array
23+ */
24+ private $ floatStore ;
2025
2126 /**
2227 * @var \SplObjectStorage
@@ -51,17 +56,41 @@ class MixedStore implements \ArrayAccess
5156 /**
5257 * @var bool
5358 */
54- private $ nullValueIsSet = false ;
59+ private $ nullValueIsSet ;
60+
61+ /**
62+ * @var mixed
63+ */
64+ private $ trueValue ;
65+
66+ /**
67+ * @var bool
68+ */
69+ private $ trueValueIsSet ;
70+
71+ /**
72+ * @var mixed
73+ */
74+ private $ falseValue ;
75+
76+ /**
77+ * @var bool
78+ */
79+ private $ falseValueIsSet ;
5580
5681 /**
5782 * MixedStore constructor.
5883 */
5984 public function __construct ()
6085 {
61- $ this ->scalarStore = [];
86+ $ this ->standardStore = [];
87+ $ this ->floatStore = [];
6288 $ this ->objectStore = new \SplObjectStorage ();
6389 $ this ->arrayKeys = [];
6490 $ this ->arrayValues = [];
91+ $ this ->nullValueIsSet = false ;
92+ $ this ->trueValueIsSet = false ;
93+ $ this ->falseValueIsSet = false ;
6594 }
6695
6796 /**
@@ -78,8 +107,17 @@ public function __construct()
78107 */
79108 public function offsetExists ($ offset )
80109 {
81- if (is_scalar ($ offset )) {
82- return array_key_exists ($ offset , $ this ->scalarStore );
110+ if (false === $ offset ) {
111+ return $ this ->falseValueIsSet ;
112+ }
113+ if (true === $ offset ) {
114+ return $ this ->trueValueIsSet ;
115+ }
116+ if (is_int ($ offset ) || is_string ($ offset )) {
117+ return array_key_exists ($ offset , $ this ->standardStore );
118+ }
119+ if (is_float ($ offset )) {
120+ return array_key_exists ((string ) $ offset , $ this ->floatStore );
83121 }
84122 if (is_object ($ offset )) {
85123 return $ this ->objectStore ->offsetExists ($ offset );
@@ -110,8 +148,17 @@ public function offsetExists($offset)
110148 */
111149 public function offsetGet ($ offset )
112150 {
113- if (is_scalar ($ offset )) {
114- return $ this ->scalarStore [$ offset ];
151+ if (true === $ offset ) {
152+ return $ this ->trueValue ;
153+ }
154+ if (false === $ offset ) {
155+ return $ this ->falseValue ;
156+ }
157+ if (is_int ($ offset ) || is_string ($ offset )) {
158+ return $ this ->standardStore [$ offset ];
159+ }
160+ if (is_float ($ offset )) {
161+ return $ this ->floatStore [(string )$ offset ];
115162 }
116163 if (is_object ($ offset )) {
117164 return $ this ->objectStore ->offsetGet ($ offset );
@@ -147,8 +194,16 @@ public function offsetGet($offset)
147194 */
148195 public function offsetSet ($ offset , $ value )
149196 {
150- if (is_scalar ($ offset )) {
151- $ this ->scalarStore [$ offset ] = $ value ;
197+ if (false === $ offset ) {
198+ $ this ->falseValue = $ value ;
199+ $ this ->falseValueIsSet = true ;
200+ } else if (true === $ offset ) {
201+ $ this ->trueValue = $ value ;
202+ $ this ->trueValueIsSet = true ;
203+ } else if (is_int ($ offset ) || is_string ($ offset )) {
204+ $ this ->standardStore [$ offset ] = $ value ;
205+ } else if (is_float ($ offset )) {
206+ $ this ->floatStore [(string )$ offset ] = $ value ;
152207 } else if (is_object ($ offset )) {
153208 $ this ->objectStore [$ offset ] = $ value ;
154209 } else if (is_array ($ offset )) {
@@ -173,8 +228,16 @@ public function offsetSet($offset, $value)
173228 */
174229 public function offsetUnset ($ offset )
175230 {
176- if (is_scalar ($ offset )) {
177- unset($ this ->scalarStore [$ offset ]);
231+ if (true === $ offset ) {
232+ $ this ->trueValue = null ;
233+ $ this ->trueValueIsSet = false ;
234+ } else if (false === $ offset ) {
235+ $ this ->falseValue = null ;
236+ $ this ->falseValueIsSet = false ;
237+ } else if (is_int ($ offset ) || is_string ($ offset )) {
238+ unset($ this ->standardStore [$ offset ]);
239+ } else if (is_float ($ offset )) {
240+ unset($ this ->floatStore [(string )$ offset ]);
178241 } else if (is_object ($ offset )) {
179242 $ this ->objectStore ->offsetUnset ($ offset );
180243 } else if (is_array ($ offset )) {
0 commit comments