public function findAll() {
		if (func_num_args() == 1) {
			$callback = func_get_arg(0);
		} else {
			$query = func_get_arg(0);
			$callback = func_get_arg(1);
		}

		$array = [];
		foreach ($this->array as $k => $element) {
			$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);

			if ($return) {
				$array[$k] = $element;
			}
		}

		return new static($array);
	}
public function findAll() {
		if (func_num_args() == 1) {
			$callback = func_get_arg(0);
		} else {
			$query = func_get_arg(0);
			$callback = func_get_arg(1);
		}

		$array = [];
		foreach ($this->array as $k => $element) {
			$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);

			if ($return) {
				$array[$k] = $element;
			}
		}

		return new static($array);
	}
public function findAll ( ) { if ( func_num_args ( ) == 1 ) { $ callback = func_get_arg ( 0 ) ; } else { $ query = func_get_arg ( 0 ) ; $ callback = func_get_arg ( 1 ) ; } $ array = [ ] ; foreach ( $ this -> array as $ k => $ element ) { $ return = func_num_args ( ) == 1 ? $ callback ( $ element ) : $ callback ( $ element , $ query ) ; if ( $ return ) { $ array [ $ k ] = $ element ; } } return new static ( $ array ) ; }
Searches the array with a given callback and returns all matching elements.

The callback function takes one or two parameters:

function ($element [, $query]) {}

The callback must return a boolean

@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null the found element or null if it hasn't been found
Searches the array with a given callback and returns all matching elements .