public static function NestedArray::filter in Blazy 7
Filters a nested array recursively.
Parameters
array $array: The filtered nested array.
callable|null $callable: The callable to apply for filtering.
Return value
array The filtered array.
2 calls to NestedArray::filter()
- BlazyBreakpoint::cleanUpBreakpoints in src/
BlazyBreakpoint.php - Cleans up empty, or not so empty, breakpoints.
- BlazyManagerBase::cleanUpBreakpoints in src/
BlazyManagerBase.php - To be deprecated method.
File
- src/
Utility/ NestedArray.php, line 206
Class
- NestedArray
- Provides helpers to perform operations on nested arrays, kidnapped from D8.
Namespace
Drupal\blazy\UtilityCode
public static function filter(array $array, callable $callable = NULL) {
$array = is_callable($callable) ? array_filter($array, $callable) : array_filter($array);
foreach ($array as &$element) {
if (is_array($element)) {
$element = static::filter($element, $callable);
}
}
return $array;
}