X7ROOT File Manager
Current Path:
/home/gfecatvj/sites/restate/platform/plugins/analytics/src
home
/
gfecatvj
/
sites
/
restate
/
platform
/
plugins
/
analytics
/
src
/
📁
..
📄
Analytics.php
(6.02 KB)
📄
AnalyticsClient.php
(2.43 KB)
📄
AnalyticsClientFactory.php
(2.06 KB)
📁
Cache
📁
Exceptions
📁
Facades
📄
GoogleClient.php
(1.84 KB)
📁
Http
📄
Period.php
(2.05 KB)
📄
Plugin.php
(850 B)
📁
Providers
Editing: Period.php
<?php namespace Botble\Analytics; use DateTime; use Carbon\Carbon; use Botble\Analytics\Exceptions\InvalidPeriod; class Period { /** * @var DateTime */ public $startDate; /** * @var DateTime */ public $endDate; /** * @param DateTime $startDate * @param DateTime $endDate * @return Period * @throws InvalidPeriod */ public static function create(DateTime $startDate, $endDate): Period { return new static($startDate, $endDate); } /** * @param int $numberOfDays * @return Period * @throws InvalidPeriod */ public static function days(int $numberOfDays): Period { $endDate = Carbon::today(config('app.timezone')); $startDate = Carbon::today(config('app.timezone'))->subDays($numberOfDays)->startOfDay(); return new static($startDate, $endDate); } /** * @param int $numberOfMonths * @return Period * @throws InvalidPeriod */ public static function months(int $numberOfMonths): Period { $endDate = Carbon::today(config('app.timezone')); $startDate = Carbon::today(config('app.timezone'))->subMonths($numberOfMonths)->startOfDay(); return new static($startDate, $endDate); } /** * @param int $numberOfYears * @return Period * @throws InvalidPeriod */ public static function years(int $numberOfYears): Period { $endDate = Carbon::today(config('app.timezone')); $startDate = Carbon::today(config('app.timezone'))->subYears($numberOfYears)->startOfDay(); return new static($startDate, $endDate); } /** * Period constructor. * @param DateTime $startDate * @param DateTime $endDate * @throws InvalidPeriod */ public function __construct(DateTime $startDate, DateTime $endDate) { if ($startDate > $endDate) { throw InvalidPeriod::startDateCannotBeAfterEndDate($startDate, $endDate); } $this->startDate = $startDate; $this->endDate = $endDate; } }
Upload File
Create Folder