File tree Expand file tree Collapse file tree 1 file changed +34
-7
lines changed
Expand file tree Collapse file tree 1 file changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ public function json(): Arrayz
137137 public function igbinary (): Arrayz
138138 {
139139 $ this ->use ('igbinary ' );
140-
140+
141141 return $ this ;
142142 }
143143
@@ -622,7 +622,7 @@ public function select(): Arrayz
622622 return $ this ;
623623 }
624624
625- /*
625+ /*
626626 * Group by a key value
627627 */
628628 public function groupBy (): Arrayz
@@ -690,8 +690,6 @@ private function checkArray($array): bool
690690 if (is_array ($ array ) && count ($ array ) > 0 ) {
691691 return true ;
692692 }
693-
694- return false ;
695693 }
696694
697695 /**
@@ -944,10 +942,39 @@ public function censor()
944942 * @param array $array
945943 * @return bool
946944 */
947- protected function isAssocArray (array $ array )
945+ public function isAssocArray (array $ array )
948946 {
949- $ keys = array_keys ($ array );
950- return array_keys ($ keys ) !== $ keys ;
947+ // An empty array is in theory a valid associative array
948+ // so we return 'true' for empty.
949+ if ([] === $ array ) {
950+ return true ;
951+ }
952+
953+ $ count = count ($ array );
954+
955+ for ($ i = 0 ; $ i < $ count ; $ i ++) {
956+ if (!array_key_exists ($ i , $ array )) {
957+ return true ;
958+ }
959+ }
960+
961+ // Dealing with a Sequential array
962+ return false ;
963+ }
964+
965+ /**
966+ * Determine if given array is multidimensional
967+ *
968+ * @param array $array
969+ * @return bool
970+ */
971+ public function isMultiArray (array $ array )
972+ {
973+ foreach ($ array as $ value ) {
974+ if (is_array ($ value )) return true ;
975+ }
976+
977+ return false ;
951978 }
952979
953980 /**
You can’t perform that action at this time.
0 commit comments