Create a new iterator
Parameters
$data
arrayrequired- The array or object to be iterated on.
$callback
callablerequired- Callback to be called on each value
Source
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;
}
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.