Exemple #1
0
 /**
  * Event constructor.
  *
  * @param \DateTime $start_date
  * @param \DateTime $end_date
  * @param $unit
  * @param $value
  */
 public function __construct(\DateTime $start_date, \DateTime $end_date, Unit $unit, $value = 0)
 {
     $this->unit_id = $unit->getUnitId();
     $this->unit = $unit;
     $this->start_date = clone $start_date;
     $this->end_date = clone $end_date;
     $this->value = $value;
 }
Exemple #2
0
 /**
  * @param $unit
  * @param $reason
  *
  * @return bool
  */
 public function removeFromMatched(Unit $unit, $reason = '', Constraint $constraint = NULL)
 {
     if (isset($this->included_set[$unit->getUnitId()])) {
         // Remove a unit from matched and add to the missed set
         unset($this->included_set[$unit->getUnitId()]);
         $this->addMiss($unit, $reason, $constraint);
         return TRUE;
     } else {
         return FALSE;
     }
 }