芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/yeahea.digitalhubbd.com/app/Helpers/Period.php
<?php namespace App\Helpers; use App\Exceptions\Validations\InvalidPeriod; use Carbon\Carbon; use DateTime; class Period { /** @var \DateTime */ public $startDate; /** @var \DateTime */ public $endDate; public static function create(DateTime $startDate, $endDate): self { return new static($startDate, $endDate); } public static function days(int $numberOfDays): self { $endDate = Carbon::today(); $startDate = Carbon::today()->subDays($numberOfDays)->startOfDay(); return new static($startDate, $endDate); } public static function months(int $numberOfMonths): self { $endDate = Carbon::today(); $startDate = Carbon::today()->subMonths($numberOfMonths)->startOfDay(); return new static($startDate, $endDate); } public static function years(int $numberOfYears): self { $endDate = Carbon::today(); $startDate = Carbon::today()->subYears($numberOfYears)->startOfDay(); return new static($startDate, $endDate); } public function __construct(DateTime $startDate, DateTime $endDate) { if ($startDate > $endDate) { throw InvalidPeriod::startDateCannotBeAfterEndDate($startDate, $endDate); } $this->startDate = $startDate; $this->endDate = $endDate; } }
Page is not found
Oops! Page not found.
Sorry, an error has occured, Requested page not found!
Back To Homepage