Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66746561
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
Wed, Jun 12, 19:34
Size
604 B
Mime Type
text/x-php
Expires
Fri, Jun 14, 19:34 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18245364
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