Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F474595
PhabricatorFileChunkIterator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorFileChunkIterator.php
View Options
<?php
final
class
PhabricatorFileChunkIterator
extends
Phobject
implements
Iterator
{
private
$chunks
;
private
$cursor
;
private
$begin
;
private
$end
;
private
$data
;
public
function
__construct
(
array
$chunks
,
$begin
=
null
,
$end
=
null
)
{
$chunks
=
msort
(
$chunks
,
'getByteStart'
);
$this
->
chunks
=
$chunks
;
if
(
$begin
!==
null
)
{
foreach
(
$chunks
as
$key
=>
$chunk
)
{
if
(
$chunk
->
getByteEnd
()
>=
$begin
)
{
unset
(
$chunks
[
$key
]);
}
break
;
}
$this
->
begin
=
$begin
;
}
if
(
$end
!==
null
)
{
foreach
(
$chunks
as
$key
=>
$chunk
)
{
if
(
$chunk
->
getByteStart
()
<=
$end
)
{
unset
(
$chunks
[
$key
]);
}
}
$this
->
end
=
$end
;
}
}
public
function
current
()
{
$chunk
=
head
(
$this
->
chunks
);
$data
=
$chunk
->
getDataFile
()->
loadFileData
();
if
(
$this
->
end
!==
null
)
{
if
(
$chunk
->
getByteEnd
()
>
$this
->
end
)
{
$data
=
substr
(
$data
,
0
,
(
$this
->
end
-
$chunk
->
getByteStart
()));
}
}
if
(
$this
->
begin
!==
null
)
{
if
(
$chunk
->
getByteStart
()
<
$this
->
begin
)
{
$data
=
substr
(
$data
,
(
$this
->
begin
-
$chunk
->
getByteStart
()));
}
}
return
$data
;
}
public
function
key
()
{
return
head_key
(
$this
->
chunks
);
}
public
function
next
()
{
unset
(
$this
->
chunks
[
$this
->
key
()]);
}
public
function
rewind
()
{
return
;
}
public
function
valid
()
{
return
(
count
(
$this
->
chunks
)
>
0
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 6, 9:02 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
83434
Default Alt Text
PhabricatorFileChunkIterator.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment