Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F455589
PhabricatorFactSpec.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 7:06 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70221
Default Alt Text
PhabricatorFactSpec.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment