Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2889512
PhabricatorLunarPhasePolicyRule.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
1 KB
Referenced Files
None
Subscribers
None
PhabricatorLunarPhasePolicyRule.php
View Options
<?php
final
class
PhabricatorLunarPhasePolicyRule
extends
PhabricatorPolicyRule
{
const
PHASE_FULL
=
'full'
;
const
PHASE_NEW
=
'new'
;
const
PHASE_WAXING
=
'waxing'
;
const
PHASE_WANING
=
'waning'
;
public
function
getRuleDescription
(
)
{
return
pht
(
'when the moon'
)
;
}
public
function
applyRule
(
PhabricatorUser
$viewer
,
$value
,
PhabricatorPolicyInterface
$object
)
{
$moon
=
new
PhutilLunarPhase
(
PhabricatorTime
::
getNow
(
)
)
;
switch
(
$value
)
{
case
'full'
:
return
$moon
->
isFull
(
)
;
case
'new'
:
return
$moon
->
isNew
(
)
;
case
'waxing'
:
return
$moon
->
isWaxing
(
)
;
case
'waning'
:
return
$moon
->
isWaning
(
)
;
default
:
return
false
;
}
}
public
function
getValueControlType
(
)
{
return
self
::
CONTROL_TYPE_SELECT
;
}
public
function
getValueControlTemplate
(
)
{
return
array
(
'options'
=>
array
(
self
::
PHASE_FULL
=>
pht
(
'is full'
)
,
self
::
PHASE_NEW
=>
pht
(
'is new'
)
,
self
::
PHASE_WAXING
=>
pht
(
'is waxing'
)
,
self
::
PHASE_WANING
=>
pht
(
'is waning'
)
,
)
,
)
;
}
public
function
getRuleOrder
(
)
{
return
1000
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 12:16 (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1110136
Default Alt Text
PhabricatorLunarPhasePolicyRule.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment