Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1335985
ItemizationIterator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
922 B
Referenced Files
None
Subscribers
None
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
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jul 6, 7:31 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
316090
Default Alt Text
ItemizationIterator.php (922 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment