Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93000786
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
Mon, Nov 25, 12:13
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 12:13 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22555290
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