Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63979681
PhutilCallbackFilterIterator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, May 23, 18:34
Size
611 B
Mime Type
text/x-php
Expires
Sat, May 25, 18:34 (2 d)
Engine
blob
Format
Raw Data
Handle
17841733
Attached To
rPHU libphutil
PhutilCallbackFilterIterator.php
View Options
<?php
/**
* NOTE: This class has the same purpose as `CallbackFilterIterator` in PHP 5.4.
*/
final
class
PhutilCallbackFilterIterator
extends
FilterIterator
{
private
$callback
;
/**
* @param Iterator
* @param callable 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
;
}
public
function
accept
()
{
return
call_user_func
(
$this
->
callback
,
$this
->
current
());
}
}
Event Timeline
Log In to Comment