Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86407657
AlmanacSearchEngineAttachment.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
Sun, Oct 6, 07:54
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Oct 8, 07:54 (2 d)
Engine
blob
Format
Raw Data
Handle
21418080
Attached To
rPH Phabricator
AlmanacSearchEngineAttachment.php
View Options
<?php
abstract
class
AlmanacSearchEngineAttachment
extends
PhabricatorSearchEngineAttachment
{
protected
function
getAlmanacPropertyList
(
$object
)
{
$builtins
=
$object
->
getAlmanacPropertyFieldSpecifications
();
$properties
=
array
();
foreach
(
$object
->
getAlmanacProperties
()
as
$key
=>
$property
)
{
$is_builtin
=
isset
(
$builtins
[
$key
]);
$properties
[]
=
array
(
'key'
=>
$key
,
'value'
=>
$property
->
getFieldValue
(),
'builtin'
=>
$is_builtin
,
);
}
return
$properties
;
}
protected
function
getAlmanacBindingDictionary
(
AlmanacBinding
$binding
)
{
$interface
=
$binding
->
getInterface
();
return
array
(
'id'
=>
(
int
)
$binding
->
getID
(),
'phid'
=>
$binding
->
getPHID
(),
'properties'
=>
$this
->
getAlmanacPropertyList
(
$binding
),
'interface'
=>
$this
->
getAlmanacInterfaceDictionary
(
$interface
),
'disabled'
=>
(
bool
)
$binding
->
getIsDisabled
(),
);
}
protected
function
getAlmanacInterfaceDictionary
(
AlmanacInterface
$interface
)
{
return
array
(
'id'
=>
(
int
)
$interface
->
getID
(),
'phid'
=>
$interface
->
getPHID
(),
'address'
=>
$interface
->
getAddress
(),
'port'
=>
(
int
)
$interface
->
getPort
(),
'device'
=>
$this
->
getAlmanacDeviceDictionary
(
$interface
->
getDevice
()),
'network'
=>
$this
->
getAlmanacNetworkDictionary
(
$interface
->
getNetwork
()),
);
}
protected
function
getAlmanacDeviceDictionary
(
AlmanacDevice
$device
)
{
return
array
(
'id'
=>
(
int
)
$device
->
getID
(),
'phid'
=>
$device
->
getPHID
(),
'name'
=>
$device
->
getName
(),
'properties'
=>
$this
->
getAlmanacPropertyList
(
$device
),
);
}
protected
function
getAlmanacNetworkDictionary
(
AlmanacNetwork
$network
)
{
return
array
(
'id'
=>
(
int
)
$network
->
getID
(),
'phid'
=>
$network
->
getPHID
(),
'name'
=>
$network
->
getName
(),
);
}
}
Event Timeline
Log In to Comment