Check if array is iterable without full key diff.
~0.5-1% performance gain.
This commit is contained in:
@@ -61,10 +61,17 @@ class Context {
|
||||
if (is_object($value)) {
|
||||
return $value instanceof \Traversable;
|
||||
} elseif (is_array($value)) {
|
||||
return !array_diff_key($value, array_keys(array_keys($value)));
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($value as $k => $v) {
|
||||
if ($k !== $i++) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user