Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | public function validateTransactions($object, array $xactions) { | ||||
return $errors; | return $errors; | ||||
} | } | ||||
public function getIcon() { | public function getIcon() { | ||||
return 'fa-calculator'; | return 'fa-calculator'; | ||||
} | } | ||||
/** | |||||
* Normalize your Story Points from generic stuff to double or null. | |||||
* @param mixed $value Your raw Story Points | |||||
* @return double|null | |||||
*/ | |||||
private function getValueForPoints($value) { | private function getValueForPoints($value) { | ||||
if (!strlen($value)) { | // The Point can be various types also thanks to Conduit API | ||||
// like integers, floats, null, and strings of course. | |||||
// Everything meaningful must be printable as a string. | |||||
$is_empty = phutil_string_cast($value) === ''; | |||||
if ($is_empty) { | |||||
$value = null; | $value = null; | ||||
} | } | ||||
if ($value !== null) { | if ($value !== null) { | ||||
$value = (double)$value; | $value = (double)$value; | ||||
} | } | ||||
return $value; | return $value; | ||||
} | } | ||||
Show All 13 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0