src/Calendar.php
/**
     * @param \DateTime $date Start date.
     * @param integer $days Positive/negative number of working days.
     * @return integer Number of working days.
     */
@param \DateTime $date Start date.
@param integer $days Positive/negative number of working days.
@return integer Number of working days.
@param \ DateTime $date Start date . @param integer $days Positive / negative number of working days . @return integer Number of working days .
public function workingToCalendarDays(\DateTime $date, $days)
    {
        if (!$days) {
            return 0;
        }
        $workingDays = 0;
        $sign = $days < 0 ? -1 : 1;
        $step = $this->getStep($sign);
        $endDate = clone $date;
        $day = 0;
        while ($day != $days) {
            $endDate->add($step);
            if (!$this->schedule->isHoliday($endDate)) {
                $day += $sign;
            }
        }
        return $this->intervalToDays($date->diff($endDate));
    }
public function workingToCalendarDays ( \ DateTime $ date , $ days ) { if ( ! $ days ) { return 0 ; } $ workingDays = 0 ; $ sign = $ days < 0 ? - 1 : 1 ; $ step = $ this -> getStep ( $ sign ) ; $ endDate = clone $ date ; $ day = 0 ; while ( $ day != $ days ) { $ endDate -> add ( $ step ) ; if ( ! $ this -> schedule -> isHoliday ( $ endDate ) ) { $ day += $ sign ; } } return $ this -> intervalToDays ( $ date -> diff ( $ endDate ) ) ; }
@param \DateTime $date Start date.
@param \ DateTime $date Start date .