1 | <?php |
||
21 | abstract class AdminPageFramework_Utility_ArrayGetter extends AdminPageFramework_Utility_Array { |
||
1 ignored issue
–
show
|
|||
22 | |||
23 | /** |
||
24 | * Returns a first iterated array element. |
||
25 | * @since 3.6.0 |
||
26 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
27 | */ |
||
28 | static public function getFirstElement( array $aArray ) { |
||
33 | |||
34 | /** |
||
35 | * Returns an array element value by the given key. |
||
36 | * |
||
37 | * It just saves isset() conditional checks and allows a default value to be set. |
||
38 | * |
||
39 | * @since 3.4.0 |
||
40 | * @since 3.5.3 The second parameter accepts an array representing dimensional keys. Added the fourth parameter to set values that the default value will be applied to. |
||
41 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
42 | * @param array $aSubject The subject array to parse. |
||
43 | * @param string|array|integer $aisKey The key to check. If an array is passed, it checks dimensional keys. |
||
44 | * @param mixed $mDefault The default value to return when the key is not set. |
||
45 | * @param string|array $asToDefault When the returning value matches oen of the set values here, the value(s) will be discarded and the default value will be applied. |
||
46 | * @return mixed The set value or the default value. |
||
47 | */ |
||
48 | static public function getElement( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
||
63 | |||
64 | /** |
||
65 | * Returns an array element value by the given key as an array. |
||
66 | * |
||
67 | * When the retrieving array element value is unknown whether it is set or not and it should be an array, |
||
68 | * this method can save the lines of isset() and is_array(). |
||
69 | * |
||
70 | * @since 3.4.0 |
||
71 | * @since 3.5.3 The second parameter accepts dimensional array keys and added the fourth parameter. |
||
72 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
73 | * @return array The cast retrieved element value. |
||
74 | */ |
||
75 | static public function getElementAsArray( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
||
81 | |||
82 | /** |
||
83 | * Removes elements of non-numeric keys from the given array. |
||
84 | * |
||
85 | * @since 3.0.0 |
||
86 | * @since 3.5.3 Changed the name from `getIntegerElements`. Added a type hint in the first parameter. |
||
87 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
88 | * @return array |
||
89 | */ |
||
90 | static public function getIntegerKeyElements( array $aParse ) { |
||
109 | |||
110 | /** |
||
111 | * Removes integer keys from the array. |
||
112 | * |
||
113 | * @since 3.0.0 |
||
114 | * @since 3.5.3 Changed the name from `getNonIntegerElements()`. |
||
115 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
116 | * @return array |
||
117 | */ |
||
118 | static public function getNonIntegerKeyElements( array $aParse ) { |
||
128 | |||
129 | /** |
||
130 | * Retrieves an array element by the given array representing the dimensional key structure. |
||
131 | * |
||
132 | * e.g. The following code will yield eee. |
||
133 | * <code> |
||
134 | * $a = array( |
||
135 | * 'a' => array( |
||
136 | * 'b' => array( |
||
137 | * 'c' => array( |
||
138 | * 'd' => array( |
||
139 | * 'e' => 'eee', |
||
140 | * ), |
||
141 | * ), |
||
142 | * ), |
||
143 | * ), |
||
144 | * ); |
||
145 | * $aKeys = array( 'a', 'b', 'c', 'd', 'e' ); |
||
146 | * $v = getArrayValueByArrayKeys( $a, $aKeys, 'default value' ); |
||
147 | * var_dump( $v ); |
||
148 | * </code> |
||
149 | * |
||
150 | * @since 3.0.1 |
||
151 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
152 | * @return mixed |
||
153 | */ |
||
154 | static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault=null ) { |
||
181 | |||
182 | /** |
||
183 | * Casts array but does not create an empty element with the zero key when non-true value is given. |
||
184 | * |
||
185 | * @remark If `null` is passed an empty array `array()` will be returned. |
||
186 | * @since 3.0.1 |
||
187 | * @since 3.5.3 Added the `$bPreserveEmpty` parameter. |
||
188 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
189 | * @param mixed $mValue The subject value. |
||
190 | * @param boolean bPreserveEmpty If `false` is given, a value that yields `false` such as `false`, an empty sttring `''`, or `0` will not create an element such as `array( false )`. It will be just `array()`. |
||
191 | * @return array The cast array. |
||
192 | */ |
||
193 | static public function getAsArray( $mValue, $bPreserveEmpty=false ) { |
||
210 | |||
211 | /** |
||
212 | * Extracts array elements by giving keys. |
||
213 | * |
||
214 | * <h4>Example</h4> |
||
215 | * <code> |
||
216 | * $array = array( 'a' => 1, 'b' => 3, 'c' => 5 ); |
||
217 | * $array = getArrayElementsByKeys( $array, array( 'a', 'c', ) ), |
||
218 | * </code> |
||
219 | * will produce |
||
220 | * <code> |
||
221 | * array( |
||
222 | * 'a' => 1, |
||
223 | * 'c' => 5, |
||
224 | * ) |
||
225 | * </code> |
||
226 | * @since 3.5.4 |
||
227 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
||
228 | * @return array |
||
229 | */ |
||
230 | static public function getArrayElementsByKeys( array $aSubject, array $aKeys ) { |
||
236 | |||
237 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.