Example #1
0
 /**
  * @param string $unit
  * @return Time|null
  */
 public function findIn($unit)
 {
     if ($unit === $this->getUnit()) {
         return clone $this;
     }
     $bonus = $this->timeTable->toBonus($this);
     return $this->timeTable->hasTimeFor($bonus, $unit) ? $this->timeTable->toTime($bonus, $unit) : null;
 }
 /**
  * @param string|null $wantedUnit
  * @return Time|null
  */
 public function findTime($wantedUnit = null)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     return $this->timeTable->hasTimeFor($this, $wantedUnit) ? $this->timeTable->toTime($this, $wantedUnit) : null;
 }