Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93517940
PhabricatorFactSpec.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, Nov 29, 09:50
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 09:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22655311
Attached To
rPH Phabricator
PhabricatorFactSpec.php
View Options
<?php
abstract
class
PhabricatorFactSpec
{
const
UNIT_COUNT
=
'unit-count'
;
const
UNIT_EPOCH
=
'unit-epoch'
;
public
static
function
newSpecsForFactTypes
(
array
$engines
,
array
$fact_types
)
{
assert_instances_of
(
$engines
,
'PhabricatorFactEngine'
);
$map
=
array
();
foreach
(
$engines
as
$engine
)
{
$specs
=
$engine
->
getFactSpecs
(
$fact_types
);
$specs
=
mpull
(
$specs
,
null
,
'getType'
);
$map
+=
$specs
;
}
foreach
(
$fact_types
as
$type
)
{
if
(
empty
(
$map
[
$type
]))
{
$map
[
$type
]
=
new
PhabricatorFactSimpleSpec
(
$type
);
}
}
return
$map
;
}
abstract
public
function
getType
();
public
function
getUnit
()
{
return
null
;
}
public
function
getName
()
{
return
pht
(
'Fact (%s)'
,
$this
->
getType
());
}
public
function
formatValueForDisplay
(
PhabricatorUser
$user
,
$value
)
{
$unit
=
$this
->
getUnit
();
switch
(
$unit
)
{
case
self
::
UNIT_COUNT
:
return
number_format
(
$value
);
case
self
::
UNIT_EPOCH
:
return
phabricator_datetime
(
$value
,
$user
);
default
:
return
$value
;
}
}
}
Event Timeline
Log In to Comment