WpOrg\Requests\Utility

FilteredIterator::__construct()publicWP 1.0

Create a new iterator

Method of the class: FilteredIterator{}

No Hooks.

Return

null. Nothing (null).

Usage

$FilteredIterator = new FilteredIterator();
$FilteredIterator->__construct( $data, $callback );
$data(array) (required)
The array or object to be iterated on.
$callback(callable) (required)
Callback to be called on each value

FilteredIterator::__construct() code WP 6.6.2

public function __construct($data, $callback) {
	if (InputValidator::is_iterable($data) === false) {
		throw InvalidArgument::create(1, '$data', 'iterable', gettype($data));
	}

	parent::__construct($data);

	if (is_callable($callback)) {
		$this->callback = $callback;
	}
}