Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63278427
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
Sun, May 19, 00:13
Size
604 B
Mime Type
text/x-php
Expires
Tue, May 21, 00:13 (2 d)
Engine
blob
Format
Raw Data
Handle
17719572
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
(
'Callback must be callable.'
);
}
$this
->
callback
=
$callback
;
}
public
function
accept
()
{
return
call_user_func
(
$this
->
callback
,
$this
->
current
());
}
}
Event Timeline
Log In to Comment