[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/phrequent/storage/ -> PhrequentTimeSlices.php (source)

   1  <?php
   2  
   3  final 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  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1