File tree 1 file changed +11
-7
lines changed
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,18 @@ public function is_match( $actual ) {
11
11
return false ;
12
12
}
13
13
$ match_count = 0 ;
14
+ $ is_associative = $ this ->is_associative ( $ actual );
14
15
foreach ( $ this ->expected_array as $ key => $ value ) {
15
- // Compare associative arrays
16
- if ( array_key_exists ( $ key , $ actual ) && $ actual [ $ key ] === $ value ) {
17
- $ match_count += 1 ;
18
- }
19
- // Compare indexed arrays
20
- if ( ! $ this ->is_associative ( $ actual ) && in_array ( $ value , $ actual ) ) {
21
- $ match_count += 1 ;
16
+ if ( $ is_associative ) {
17
+ // Compare associative arrays
18
+ if ( array_key_exists ( $ key , $ actual ) && $ actual [ $ key ] === $ value ) {
19
+ $ match_count += 1 ;
20
+ }
21
+ } else {
22
+ // Compare indexed arrays
23
+ if ( ! $ this ->is_associative ( $ actual ) && in_array ( $ value , $ actual ) ) {
24
+ $ match_count += 1 ;
25
+ }
22
26
}
23
27
}
24
28
return ( count ( $ this ->expected_array ) === $ match_count );
You can’t perform that action at this time.
0 commit comments