public function __construct(Season\Name $name, Period $period) { if ($period === null) { throw new \InvalidArgumentException("de periode moet gezet zijn", E_ERROR); } parent::__construct($period->getStartDate(), $period->getEndDate()); if ($name === null) { throw new \InvalidArgumentException("de naam moet gezet zijn", E_ERROR); } $this->m_name = $name; }
/** * Computes the gap between two Period objects. * * @param Period $period * * @return static */ public function gap(Period $period) { if ($period->getStartDate() > $this->startDate) { return new static($this->endDate, $period->getStartDate()); } return new static($period->getEndDate(), $this->startDate); }