Roomify\Bat\Constraint\CheckInDayConstraint::applyConstraint PHP Метод

applyConstraint() публичный Метод

public applyConstraint ( Roomify\Bat\Calendar\CalendarResponse &$calendar_response )
$calendar_response Roomify\Bat\Calendar\CalendarResponse
    public function applyConstraint(CalendarResponse &$calendar_response)
    {
        parent::applyConstraint($calendar_response);
        if ($this->start_date === NULL) {
            $this->start_date = new \DateTime('1970-01-01');
        }
        if ($this->end_date === NULL) {
            $this->end_date = new \DateTime('2999-12-31');
        }
        if (($calendar_response->getStartDate()->getTimestamp() >= $this->start_date->getTimestamp() && $calendar_response->getStartDate()->getTimestamp() <= $this->end_date->getTimestamp() || $calendar_response->getStartDate()->getTimestamp() <= $this->start_date->getTimestamp() && $calendar_response->getEndDate()->getTimestamp() >= $this->end_date->getTimestamp()) && $this->checkin_day != $calendar_response->getStartDate()->format('N')) {
            $units = $this->getUnits();
            $included_set = $calendar_response->getIncluded();
            foreach ($included_set as $unit_id => $set) {
                if (isset($units[$unit_id]) || empty($units)) {
                    $calendar_response->removeFromMatched($included_set[$unit_id]['unit'], CalendarResponse::CONSTRAINT, $this);
                    $this->affected_units[$unit_id] = $included_set[$unit_id]['unit'];
                }
            }
        }
    }