Retorna um objeto DateTime referente ao último dia da última semana do ano informado.

@param       int $y
Ano.

@return      DateTime
760659
public static function lastWeekOfYear(int $y) : \DateTime
    {
        $o = self::firstWeekOfYear($y + 1);
        return $o->sub(new \DateInterval("P1D"));
    }
573870
public function findByDate(\DateTime $date = null)
    {
        $date = $date ?: new \DateTime();

        return $this->repository->findByDate($date);
    }
899147
public static function format($y): int
    {
        $y = (int)$y;
        if ($y < 1 || $y > 7) {
            throw new \LogicException(sprintf(
                'Incorrect day of week: %s. Available range 1-7 where 1 - monday.',
                $y
            ));
        }

        return 7 === $y ? 1 : $y + 1;
    }
891166
public function getDateUpdated() : DateTime
     {
        $rtn = $this->data['date_updated'];

        if (!empty($rtn)) {
            $rtn = new DateTime($rtn);
        }

        return $rtn;
     }
522279
private function getClosestDateBefore(\DateTime $date)
    {
        $tmpDate = clone $date;
        $dayOfWeek = (int) $tmpDate->format('N');
        $time = Time::fromDate($tmpDate);

        if (!$this->holidays->isHoliday($tmpDate) && null !== $day = $this->getDay($dayOfWeek)) {
            if (null !== $closestTime = $day->getClosestOpeningTimeBefore($time, $tmpDate)) {
                $tmpDate->setTime($closestTime->getHours(), $closestTime->getMinutes(), $closestTime->getSeconds());

                return $tmpDate;
            }
        }

        $tmpDate = $this->getDateBefore($tmpDate);

        while ($this->holidays->isHoliday($tmpDate)) {
            $tmpDate = $this->getDateBefore($tmpDate);
        }

        $closestDay = $this->getClosestDayBefore((int) $tmpDate->format('N'));
        $closingTime = $closestDay->getClosingTime($tmpDate);
        $tmpDate->setTime($closingTime->getHours(), $closingTime->getMinutes(), $closingTime->getSeconds());

        return $tmpDate;
    }
128494
public function setDateTime(DateTime $date)
    {
        $this->setYear((int)$date->format('Y'));
        $this->setMonth((int)$date->format('m'));
        $this->setDay((int)$date->format('d'));

        return $this;
    }
380021
public function date($date)
    {
        if (! $date instanceof DateTime) {
            $date = new DateTime($date);
        }

        $this->executionYear = $date->format('Y');

        return $this->at("{$date->format('i')} {$date->format('H')} {$date->format('d')} {$date->format('m')} *");
    }
1307170
public function formatDateTime($value): \DateTime
    {
        if ($value instanceof \DateTime) {
            return $value;
        }

        if (is_numeric($value)) {
            $date = new \DateTime();
            $date->setTimestamp((int) $value);

            return $date;
        } elseif (null === $value) {
            return new \DateTime();
        }

        return new \DateTime($value);
    }
37691
public function getDate(): \DateTime
    {
        /*
            RFC2616 - 14.18 says all Responses need to have a Date.
            Make sure we provide one even if it the header
            has been removed in the meantime.
         */
        if (!$this->header->has('Date')) {
            $this->setDate(\DateTime::createFromFormat('U', (string) \time()));
        }

        return $this->header->getDate('Date');
    }
996009
public static function getDateTime($date)
    {
        $_date = time();

        if (isset($date) && self::isValidDate($date)) {
            $_date = strtotime(preg_replace('/\(.*?\)/', '', $date));
        }

        return date('Y-m-d H:i:s', $_date);
    }
843938
public function getDate($endday = false)
    {
        $date = strtotime($this->getText());
        if ($endday == true) {
            $d = date('Y-m-d', $date);
            $date = strtotime($d . ' 23:59:59');
        }
        return $date;
    }
77332
public function getDateAdded() : ?DateTime
     {
        $rtn = $this->data['date_added'];

        if (!empty($rtn)) {
            $rtn = new DateTime($rtn);
        }

        return $rtn;
     }
1313308
public static function get_DateTime( &$dateTime )
    {
        if( $dateTime instanceof DateTime ) {
            return $dateTime;
        }
        return !is_null($dateTime)
            ? new DateTime( $dateTime )
            : null
            ;
    }
1295131
public function getDate() : ?string 
    {
        if ( ! $this->hasDate()) {
            $this->setDate($this->getDefaultDate());
        }
        return $this->date;
    }
1092700
protected function getDateTime($value)
    {
        try {
            if ($this->isTestingRelativeDateTime($value)) {
                return Date::parse($value);
            }

            return new DateTime($value);
        } catch (Exception $e) {
            //
        }
    }
297790
public function getDeletedAtDatetime(string $timezone = null): ?DateTime
    {
        if (!$this->isDeleted()) {
            return null;
        }

        return new DateTime($this->getDeletedAt(), new DateTimeZone($timezone ?? 'UTC'));
    }
1183500
public function getLogDate() : DateTime
     {
        $rtn = $this->data['log_date'];

        if (!empty($rtn)) {
            $rtn = new DateTime($rtn);
        }

        return $rtn;
     }