Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22406772
ConduitSearchFuture.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
ConduitSearchFuture.php
View Options
<?php
final
class
ConduitSearchFuture
extends
FutureAgent
{
private
$conduitEngine
;
private
$method
;
private
$constraints
;
private
$attachments
;
private
$objects
=
array
();
private
$cursor
;
public
function
setConduitEngine
(
ArcanistConduitEngine
$conduit_engine
)
{
$this
->
conduitEngine
=
$conduit_engine
;
return
$this
;
}
public
function
getConduitEngine
()
{
return
$this
->
conduitEngine
;
}
public
function
setMethod
(
$method
)
{
$this
->
method
=
$method
;
return
$this
;
}
public
function
getMethod
()
{
return
$this
->
method
;
}
public
function
setConstraints
(
array
$constraints
)
{
$this
->
constraints
=
$constraints
;
return
$this
;
}
public
function
getConstraints
()
{
return
$this
->
constraints
;
}
public
function
setAttachments
(
array
$attachments
)
{
$this
->
attachments
=
$attachments
;
return
$this
;
}
public
function
getAttachments
()
{
return
$this
->
attachments
;
}
public
function
isReady
()
{
if
(
$this
->
hasResult
())
{
return
true
;
}
$futures
=
$this
->
getFutures
();
$future
=
head
(
$futures
);
if
(!
$future
)
{
$future
=
$this
->
newFuture
();
}
if
(!
$future
->
isReady
())
{
$this
->
setFutures
(
array
(
$future
));
return
false
;
}
else
{
$this
->
setFutures
(
array
());
}
$result
=
$future
->
resolve
();
foreach
(
$this
->
readResults
(
$result
)
as
$object
)
{
$this
->
objects
[]
=
$object
;
}
$cursor
=
idxv
(
$result
,
array
(
'cursor'
,
'after'
));
if
(
$cursor
===
null
)
{
$this
->
setResult
(
$this
->
objects
);
return
true
;
}
$this
->
cursor
=
$cursor
;
$future
=
$this
->
newFuture
();
$this
->
setFutures
(
array
(
$future
));
return
false
;
}
private
function
newFuture
()
{
$engine
=
$this
->
getConduitEngine
();
$method
=
$this
->
getMethod
();
$constraints
=
$this
->
getConstraints
();
$parameters
=
array
(
'constraints'
=>
$constraints
,
);
if
(
$this
->
attachments
)
{
$parameters
[
'attachments'
]
=
$this
->
attachments
;
}
if
(
$this
->
cursor
!==
null
)
{
$parameters
[
'after'
]
=
(
string
)
$this
->
cursor
;
}
$conduit_call
=
$engine
->
newCall
(
$method
,
$parameters
);
$conduit_future
=
$engine
->
newFuture
(
$conduit_call
);
return
$conduit_future
;
}
private
function
readResults
(
array
$data
)
{
return
idx
(
$data
,
'data'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 27, 20:22 (3 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1219041
Default Alt Text
ConduitSearchFuture.php (2 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline