/** * @param PeriodInterface $period * @param \DateInterval $increment */ public function __construct(PeriodInterface $period, \DateInterval $increment) { $this->period = $period; $this->increment = $increment; $this->current = $this->period->getFirstDate(); $this->lastDateStr = $period->getLastDate()->format('Y-m-d'); $this->index = 0; $this->isValid = true; }
/** * {@inheritdoc} */ public function key() { return $this->current->getBegin()->format('W'); }
/** * @param PeriodInterface $period * * @return bool */ public function isCrossWithPeriod(PeriodInterface $period) { return !($period->getFrom() > $this->getTo() || $period->getTo() < $this->getFrom()) ? true : false; }