Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99645084
MultimeterController.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
Sat, Jan 25, 23:13
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 27, 23:13 (2 d)
Engine
blob
Format
Raw Data
Handle
23837995
Attached To
rPH Phabricator
MultimeterController.php
View Options
<?php
abstract
class
MultimeterController
extends
PhabricatorController
{
private
$dimensions
=
array
();
protected
function
loadDimensions
(
array
$rows
)
{
if
(!
$rows
)
{
return
;
}
$map
=
array
(
'eventLabelID'
=>
new
MultimeterLabel
(),
'eventViewerID'
=>
new
MultimeterViewer
(),
'eventHostID'
=>
new
MultimeterHost
(),
'eventContextID'
=>
new
MultimeterContext
(),
);
$ids
=
array
();
foreach
(
$map
as
$key
=>
$object
)
{
foreach
(
$rows
as
$row
)
{
$ids
[
$key
][]
=
$row
[
$key
];
}
}
foreach
(
$ids
as
$key
=>
$list
)
{
$object
=
$map
[
$key
];
if
(
empty
(
$this
->
dimensions
[
$key
]))
{
$this
->
dimensions
[
$key
]
=
array
();
}
$this
->
dimensions
[
$key
]
+=
$object
->
loadAllWhere
(
'id IN (%Ld)'
,
$list
);
}
}
protected
function
getLabelDimension
(
$id
)
{
if
(
empty
(
$this
->
dimensions
[
'eventLabelID'
][
$id
]))
{
return
$this
->
newMissingDimension
(
new
MultimeterLabel
(),
$id
);
}
return
$this
->
dimensions
[
'eventLabelID'
][
$id
];
}
protected
function
getViewerDimension
(
$id
)
{
if
(
empty
(
$this
->
dimensions
[
'eventViewerID'
][
$id
]))
{
return
$this
->
newMissingDimension
(
new
MultimeterViewer
(),
$id
);
}
return
$this
->
dimensions
[
'eventViewerID'
][
$id
];
}
protected
function
getHostDimension
(
$id
)
{
if
(
empty
(
$this
->
dimensions
[
'eventHostID'
][
$id
]))
{
return
$this
->
newMissingDimension
(
new
MultimeterHost
(),
$id
);
}
return
$this
->
dimensions
[
'eventHostID'
][
$id
];
}
protected
function
getContextDimension
(
$id
)
{
if
(
empty
(
$this
->
dimensions
[
'eventContextID'
][
$id
]))
{
return
$this
->
newMissingDimension
(
new
MultimeterContext
(),
$id
);
}
return
$this
->
dimensions
[
'eventContextID'
][
$id
];
}
private
function
newMissingDimension
(
MultimeterDimension
$dim
,
$id
)
{
$dim
->
setName
(
'<missing:'
.
$id
.
'>'
);
return
$dim
;
}
}
Event Timeline
Log In to Comment