Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101298275
PhabricatorEdgeGraph.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Feb 7, 14:17
Size
750 B
Mime Type
text/x-php
Expires
Sun, Feb 9, 14:17 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24125716
Attached To
rPH Phabricator
PhabricatorEdgeGraph.php
View Options
<?php
final
class
PhabricatorEdgeGraph
extends
AbstractDirectedGraph
{
private
$edgeType
;
public
function
setEdgeType
(
$edge_type
)
{
$this
->
edgeType
=
$edge_type
;
return
$this
;
}
protected
function
loadEdges
(
array
$nodes
)
{
if
(!
$this
->
edgeType
)
{
throw
new
Exception
(
'Set edge type before loading graph!'
);
}
$edges
=
id
(
new
PhabricatorEdgeQuery
())
->
withSourcePHIDs
(
$nodes
)
->
withEdgeTypes
(
array
(
$this
->
edgeType
))
->
execute
();
$results
=
array_fill_keys
(
$nodes
,
array
());
foreach
(
$edges
as
$src
=>
$types
)
{
foreach
(
$types
as
$type
=>
$dsts
)
{
foreach
(
$dsts
as
$dst
=>
$edge
)
{
$results
[
$src
][]
=
$dst
;
}
}
}
return
$results
;
}
}
Event Timeline
Log In to Comment