src/Calendar.php
/**
     * @param \DateTime $date Start date.
     * @param \DateTime|integer $days End date or positive/negative number of calendar days.
     * @return integer Number of working days.
     */
@param \DateTime $date Start date.
@param \DateTime|integer $days End date or positive/negative number of calendar days.
@return integer Number of working days.
@param \ DateTime $date Start date . @param \ DateTime|integer $days End date or positive / negative number of calendar days . @return integer Number of working days .
public function calendarToWorkingDays(\DateTime $date, $days)
    {
        if (!$days) {
            return 0;
        }
        if ($days instanceof \DateTime) {
            $days = $this->intervalToDays($date->diff($days));
        }
        $workingDays = 0;
        $sign = $days < 0 ? -1 : 1;
        $step = $this->getStep($sign);
        for ($day = 0; $day != $days; $day += $sign) {
            $date->add($step);
            if (!$this->schedule->isHoliday($date)) {
                $workingDays += $sign;
            }
        }
        return $workingDays;
    }
public function calendarToWorkingDays ( \ DateTime $ date , $ days ) { if ( ! $ days ) { return 0 ; } if ( $ days instanceof \ DateTime ) { $ days = $ this -> intervalToDays ( $ date -> diff ( $ days ) ) ; } $ workingDays = 0 ; $ sign = $ days < 0 ? - 1 : 1 ; $ step = $ this -> getStep ( $ sign ) ; for ( $ day = 0 ; $ day != $ days ; $ day += $ sign ) { $ date -> add ( $ step ) ; if ( ! $ this -> schedule -> isHoliday ( $ date ) ) { $ workingDays += $ sign ; } } return $ workingDays ; }
@param \DateTime $date Start date.
@param \ DateTime $date Start date .