Page MenuHomePhorge

PhutilCallbackFilterIterator.php
No OneTemporary

PhutilCallbackFilterIterator.php

<?php
/**
* NOTE: This class has the same purpose as `CallbackFilterIterator` in PHP 5.4.
*/
final class PhutilCallbackFilterIterator extends FilterIterator {
private $callback;
/**
* @param Iterator $iterator
* @param callable $callback Signature: (mixed $current): bool.
*/
public function __construct(Iterator $iterator, $callback) {
parent::__construct($iterator);
if (!is_callable($callback)) {
throw new Exception(pht('Callback must be callable.'));
}
$this->callback = $callback;
}
#[\ReturnTypeWillChange]
public function accept() {
return call_user_func($this->callback, $this->current());
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Mar 27, 00:51 (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1115445
Default Alt Text
PhutilCallbackFilterIterator.php (658 B)

Event Timeline