Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891501
DrydockResourceStatus.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
DrydockResourceStatus.php
View Options
<?php
final
class
DrydockResourceStatus
extends
PhabricatorObjectStatus
{
const
STATUS_PENDING
=
'pending'
;
const
STATUS_ACTIVE
=
'active'
;
const
STATUS_RELEASED
=
'released'
;
const
STATUS_BROKEN
=
'broken'
;
const
STATUS_DESTROYED
=
'destroyed'
;
public
static
function
newStatusObject
(
$key
)
{
return
new
self
(
$key
,
id
(
new
self
(
)
)
->
getStatusSpecification
(
$key
)
)
;
}
public
static
function
getStatusMap
(
)
{
$map
=
id
(
new
self
(
)
)
->
getStatusSpecifications
(
)
;
return
ipull
(
$map
,
'name'
,
'key'
)
;
}
public
static
function
getNameForStatus
(
$status
)
{
$map
=
id
(
new
self
(
)
)
->
getStatusSpecification
(
$status
)
;
return
$map
[
'name'
]
;
}
public
static
function
getAllStatuses
(
)
{
return
array_keys
(
id
(
new
self
(
)
)
->
getStatusSpecifications
(
)
)
;
}
public
function
isActive
(
)
{
return
(
$this
->
getKey
(
)
===
self
::
STATUS_ACTIVE
)
;
}
public
function
canRelease
(
)
{
return
$this
->
getStatusProperty
(
'isReleasable'
)
;
}
public
function
canReceiveCommands
(
)
{
return
$this
->
getStatusProperty
(
'isCommandable'
)
;
}
protected
function
newStatusSpecifications
(
)
{
return
array
(
array
(
'key'
=>
self
::
STATUS_PENDING
,
'name'
=>
pht
(
'Pending'
)
,
'icon'
=>
'fa-clock-o'
,
'color'
=>
'blue'
,
'isReleasable'
=>
true
,
'isCommandable'
=>
true
,
)
,
array
(
'key'
=>
self
::
STATUS_ACTIVE
,
'name'
=>
pht
(
'Active'
)
,
'icon'
=>
'fa-check'
,
'color'
=>
'green'
,
'isReleasable'
=>
true
,
'isCommandable'
=>
true
,
)
,
array
(
'key'
=>
self
::
STATUS_RELEASED
,
'name'
=>
pht
(
'Released'
)
,
'icon'
=>
'fa-circle-o'
,
'color'
=>
'blue'
,
'isReleasable'
=>
false
,
'isCommandable'
=>
false
,
)
,
array
(
'key'
=>
self
::
STATUS_BROKEN
,
'name'
=>
pht
(
'Broken'
)
,
'icon'
=>
'fa-times'
,
'color'
=>
'indigo'
,
'isReleasable'
=>
true
,
'isCommandable'
=>
false
,
)
,
array
(
'key'
=>
self
::
STATUS_DESTROYED
,
'name'
=>
pht
(
'Destroyed'
)
,
'icon'
=>
'fa-times'
,
'color'
=>
'grey'
,
'isReleasable'
=>
false
,
'isCommandable'
=>
false
,
)
,
)
;
}
protected
function
newUnknownStatusSpecification
(
$status
)
{
return
array
(
'isReleasable'
=>
false
,
'isCommandable'
=>
false
,
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 15:17 (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125902
Default Alt Text
DrydockResourceStatus.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment