business\Business::getDateBefore PHP Method

getDateBefore() private method

Gets the business date before the given date (excluding holidays).
private getDateBefore ( DateTime $date ) : DateTime
$date DateTime
return DateTime
    private function getDateBefore(\DateTime $date)
    {
        $tmpDate = clone $date;
        $tmpDate->modify('-1 day');
        $dayOfWeek = (int) $tmpDate->format('N');
        $closestDay = $this->getClosestDayBefore($dayOfWeek);
        if ($closestDay->getDayOfWeek() !== $dayOfWeek) {
            $tmpDate->modify(sprintf('last %s', Days::toString($closestDay->getDayOfWeek())));
        }
        return $tmpDate;
    }