Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14402156
FutureProxy.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
FutureProxy.php
View Options
<?php
/**
* Wraps another Future and allows you to post-process its result once it
* resolves.
*
* @group futures
* @stable
*/
abstract
class
FutureProxy
extends
Future
{
private
$proxied
;
public
function
__construct
(
Future
$proxied
=
null
)
{
if
(
$proxied
)
{
$this
->
setProxiedFuture
(
$proxied
);
}
}
public
function
setProxiedFuture
(
Future
$proxied
)
{
$this
->
proxied
=
$proxied
;
return
$this
;
}
protected
function
getProxiedFuture
()
{
if
(!
$this
->
proxied
)
{
throw
new
Exception
(
"The proxied future has not been provided yet."
);
}
return
$this
->
proxied
;
}
public
function
isReady
()
{
return
$this
->
getProxiedFuture
()->
isReady
();
}
public
function
resolve
(
$timeout
=
null
)
{
$this
->
getProxiedFuture
()->
resolve
(
$timeout
);
return
$this
->
getResult
();
}
public
function
setException
(
Exception
$ex
)
{
$this
->
getProxiedFuture
()->
setException
(
$ex
);
return
$this
;
}
public
function
getException
()
{
return
$this
->
getProxiedFuture
()->
getException
();
}
public
function
getReadSockets
()
{
return
$this
->
getProxiedFuture
()->
getReadSockets
();
}
public
function
getWriteSockets
()
{
return
$this
->
getProxiedFuture
()->
getWriteSockets
();
}
protected
function
getResult
()
{
if
(
$this
->
result
===
null
)
{
$result
=
$this
->
getProxiedFuture
()->
resolve
();
$result
=
$this
->
didReceiveResult
(
$result
);
$this
->
result
=
$result
;
}
return
$this
->
result
;
}
public
function
start
()
{
$this
->
getProxiedFuture
()->
start
();
return
$this
;
}
abstract
protected
function
didReceiveResult
(
$result
);
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Dec 24, 11:45 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6899047
Default Alt Text
FutureProxy.php (1 KB)
Attached To
Mode
rPHU libphutil
Attached
Detach File
Event Timeline
Log In to Comment