Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F12660806
FuturePool.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
FuturePool.php
View Options
<?php
final
class
FuturePool
extends
Phobject
{
private
$shouldRewind
;
private
$iteratorTemplate
;
private
$iterator
;
private
$futures
=
array
();
public
function
__construct
()
{
$this
->
iteratorTemplate
=
new
FutureIterator
(
array
());
}
public
function
getIteratorTemplate
()
{
return
$this
->
iteratorTemplate
;
}
public
function
addFuture
(
Future
$future
)
{
$future_key
=
$future
->
getFutureKey
();
if
(!
isset
(
$this
->
futures
[
$future_key
]))
{
if
(!
$this
->
iterator
)
{
$this
->
iterator
=
clone
$this
->
getIteratorTemplate
();
$this
->
shouldRewind
=
true
;
}
$iterator
=
$this
->
iterator
;
$iterator
->
addFuture
(
$future
);
$this
->
futures
[
$future_key
]
=
$future
;
}
return
$this
;
}
public
function
getFutures
()
{
return
$this
->
futures
;
}
public
function
hasFutures
()
{
return
(
bool
)
$this
->
futures
;
}
public
function
resolve
()
{
$iterator
=
$this
->
iterator
;
if
(!
$iterator
)
{
return
null
;
}
if
(
$this
->
shouldRewind
)
{
$iterator
->
rewind
();
$this
->
shouldRewind
=
false
;
}
else
{
$iterator
->
next
();
}
if
(
$iterator
->
valid
())
{
$future_key
=
$iterator
->
key
();
if
(
$future_key
!==
null
)
{
unset
(
$this
->
futures
[
$future_key
]);
}
return
$iterator
->
current
();
}
else
{
$this
->
iterator
=
null
;
return
null
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 28, 15:42 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1051421
Default Alt Text
FuturePool.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment