| 1 | <?php |
||
| 4 | trait UtilityTrait |
||
| 5 | { |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Enhanced version of array_filter which allow to filter recursively |
||
| 9 | * |
||
| 10 | * @param array $array |
||
| 11 | * @param callable|array $callback |
||
| 12 | * @return array |
||
| 13 | */ |
||
| 14 | 19 | public function arrayFilter(array $array, $callback = ['self', 'filter']): array |
|
| 24 | |||
| 25 | /** |
||
| 26 | * Callback function for filtering. |
||
| 27 | * |
||
| 28 | * @param mixed $var Array to filter. |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | 19 | protected static function filter($var) |
|
| 35 | } |
||
| 36 |