Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3493317
ManiphestTaskPointsTransaction.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
ManiphestTaskPointsTransaction.php
View Options
<?php
final
class
ManiphestTaskPointsTransaction
extends
ManiphestTaskTransactionType
{
const
TRANSACTIONTYPE
=
'points'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getPoints
(
)
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
if
(
!
strlen
(
$value
)
)
{
$value
=
null
;
}
if
(
$value
!==
null
)
{
$value
=
(double)
$value
;
}
$object
->
setPoints
(
$value
)
;
}
public
function
shouldHideForFeed
(
)
{
return
true
;
}
public
function
shouldHide
(
)
{
if
(
!
ManiphestTaskPoints
::
getIsEnabled
(
)
)
{
return
true
;
}
return
false
;
}
public
function
getTitle
(
)
{
$old
=
$this
->
getOldValue
(
)
;
$new
=
$this
->
getNewValue
(
)
;
if
(
$old
===
null
)
{
return
pht
(
'%s set the point value for this task to %s.'
,
$this
->
renderAuthor
(
)
,
$this
->
renderNewValue
(
)
)
;
}
else
if
(
$new
===
null
)
{
return
pht
(
'%s removed the point value for this task.'
,
$this
->
renderAuthor
(
)
)
;
}
else
{
return
pht
(
'%s changed the point value for this task from %s to %s.'
,
$this
->
renderAuthor
(
)
,
$this
->
renderOldValue
(
)
,
$this
->
renderNewValue
(
)
)
;
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
(
)
;
foreach
(
$xactions
as
$xaction
)
{
$new
=
$xaction
->
getNewValue
(
)
;
if
(
strlen
(
$new
)
&&
!
is_numeric
(
$new
)
)
{
$errors
[
]
=
$this
->
newInvalidError
(
pht
(
'Points value must be numeric or empty.'
)
)
;
continue
;
}
if
(
(double)
$new
<
0
)
{
$errors
[
]
=
$this
->
newInvalidError
(
pht
(
'Points value must be nonnegative.'
)
)
;
continue
;
}
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Apr 17, 06:39 (2 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1294752
Default Alt Text
ManiphestTaskPointsTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment