@@ -11,7 +11,16 @@ class Pointer
1111 * have string indices. This option can be used to enable non-numeric
1212 * array indices addressing.
1313 */
14- const OPTION_NON_NUMERIC_ARRAY_INDICES = 0x01 ;
14+ const OPTION_NON_NUMERIC_INDICES = 0x01 ;
15+ /**
16+ * "Native" JSON arrays have consistent indices, so allowing to create
17+ * arbitrary numeric indices will break them. But PHP arrays support
18+ * arrays with "gaps" between indices, and this option enables writing
19+ * to array at any index.
20+ *
21+ * @todo Implement this option.
22+ */
23+ const OPTION_WRITE_ANY_INDEX = 0x02 ;
1524
1625 /**
1726 * Bit-packed options.
@@ -134,7 +143,7 @@ public function unsetData()
134143 public function test ()
135144 {
136145 return Pointer \Evaluate \Test::factory ()
137- ->setNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
146+ ->setNonNumericIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_INDICES ))
138147 ->setLocator ($ this ->getLocator ())
139148 ->setData ($ this ->getData ())
140149 ->perform ()
@@ -144,7 +153,7 @@ public function test()
144153 public function &read ()
145154 {
146155 return Pointer \Evaluate \Read::factory ()
147- ->setNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
156+ ->setNonNumericIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_INDICES ))
148157 ->setLocator ($ this ->getLocator ())
149158 ->setData ($ this ->getData ())
150159 ->perform ()
@@ -155,7 +164,7 @@ public function &read()
155164 public function write ($ value )
156165 {
157166 Pointer \Evaluate \Write::factory ()
158- ->setNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
167+ ->setNonNumericIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_INDICES ))
159168 ->setLocator ($ this ->getLocator ())
160169 ->setData ($ this ->getData ())
161170 ->setValue ($ value )
0 commit comments