@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 39 lines 767 B view raw
1<?php 2 3final class PhrequentTimeSlices extends Phobject { 4 5 private $objectPHID; 6 private $isOngoing; 7 private $ranges; 8 9 public function __construct($object_phid, $is_ongoing, array $ranges) { 10 $this->objectPHID = $object_phid; 11 $this->isOngoing = $is_ongoing; 12 $this->ranges = $ranges; 13 } 14 15 public function getObjectPHID() { 16 return $this->objectPHID; 17 } 18 19 public function getDuration($now) { 20 $total = 0; 21 foreach ($this->ranges as $range) { 22 if ($range[1] === null) { 23 $total += $now - $range[0]; 24 } else { 25 $total += $range[1] - $range[0]; 26 } 27 } 28 return $total; 29 } 30 31 public function getIsOngoing() { 32 return $this->isOngoing; 33 } 34 35 public function getRanges() { 36 return $this->ranges; 37 } 38 39}