Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3282252
PhutilExampleBufferedIterator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
762 B
Referenced Files
None
Subscribers
None
PhutilExampleBufferedIterator.php
View Options
<?php
/**
* Example implementation and test case for @{class:PhutilBufferedIterator}.
*/
final
class
PhutilExampleBufferedIterator
extends
PhutilBufferedIterator
{
private
$cursor
;
private
$data
;
protected
function
didRewind
(
)
{
$this
->
cursor
=
0
;
}
protected
function
loadPage
(
)
{
$result
=
$this
->
query
(
$this
->
cursor
,
$this
->
getPageSize
(
)
)
;
$this
->
cursor
+=
count
(
$result
)
;
return
$result
;
}
public
function
setExampleData
(
array
$data
)
{
$this
->
data
=
$data
;
}
private
function
query
(
$cursor
,
$limit
)
{
// NOTE: Normally you'd load or generate results from some external source
// here. Since this is an example, we just use a premade dataset.
return
array_slice
(
$this
->
data
,
$cursor
,
$limit
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 06:10 (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1115682
Default Alt Text
PhutilExampleBufferedIterator.php (762 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment