CBPCalc::getNearestWorkTime: Bitrix method

      
<?php 
//  CBPCalc :: getNearestWorkTime()
//  /dist/bitrix/modules/bizproc/classes/general/calc.php:927

    
private function getNearestWorkTime($date$multiplier 1)
    {
        
$reverse $multiplier 0;
        list (
$startSeconds$endSeconds) = $this->getCalendarWorkTime();
        
$dayTimeStamp $this->getWorkDayTimestamp($date);

        if (
$this->isHoliday($date))
        {
            
$date -= $dayTimeStamp;
            
$date += $reverse? -86400 $endSeconds $startSeconds;
            
$dayTimeStamp $reverse$endSeconds $startSeconds;
        }

        if (!
$this->isWorkTime($date))
        {
            
$date -= $dayTimeStamp;

            if (
$dayTimeStamp $startSeconds)
            {
                
$date += $reverse? -86400 $endSeconds $startSeconds;
            }
            else
            {
                
$date += $reverse$endSeconds 86400 $startSeconds;
            }
        }

        if (
$this->isHoliday($date))
            
$date $this->addWorkDay($date$reverse? -1);

        return 
$date;
    }