Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93132929
ItemizationIterator.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
Tue, Nov 26, 11:09
Size
922 B
Mime Type
text/x-php
Expires
Thu, Nov 28, 11:09 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22581574
Attached To
rPH Phabricator
ItemizationIterator.php
View Options
<?php
namespace
RESTful
;
class
ItemizationIterator
implements
\Iterator
{
protected
$_page
,
$_offset
=
0
;
public
function
__construct
(
$resource
,
$uri
,
$data
=
null
)
{
$this
->
_page
=
new
Page
(
$resource
,
$uri
,
$data
);
}
// Iterator
public
function
current
()
{
return
$this
->
_page
->
items
[
$this
->
_offset
];
}
public
function
key
()
{
return
$this
->
_page
->
offset
+
$this
->
_offset
;
}
public
function
next
()
{
$this
->
_offset
+=
1
;
if
(
$this
->
_offset
>=
count
(
$this
->
_page
->
items
))
{
$this
->
_offset
=
0
;
$this
->
_page
=
$this
->
_page
->
next
();
}
}
public
function
rewind
()
{
$this
->
_page
=
$this
->
_page
->
first
();
$this
->
_offset
=
0
;
}
public
function
valid
()
{
return
(
$this
->
_page
!=
null
&&
$this
->
_offset
<
count
(
$this
->
_page
->
items
));
}
}
Event Timeline
Log In to Comment