add customer api
This commit is contained in:
56
customerapi/models/available/EventInterval.php
Normal file
56
customerapi/models/available/EventInterval.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace customerapi\models\available;
|
||||
|
||||
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Class DateIntervalHelper
|
||||
* @package customerapi\models\available
|
||||
* @property \DateTime $firstActiveDate
|
||||
* @property \DateTime $lastActiveDate
|
||||
* @property \DateTime $firstDisplayDate
|
||||
* @property \DateTime $lastDisplayDate
|
||||
*/
|
||||
class EventInterval
|
||||
{
|
||||
|
||||
public $countOfActiveDays = 14;
|
||||
public $daysToDisplay = 21;
|
||||
|
||||
|
||||
public $firstActiveDate;
|
||||
public $lastActiveDate;
|
||||
public $firstDisplayDate;
|
||||
public $lastDisplayDate;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
$firstActiveDay = new DateTime();
|
||||
$firstActiveDay->setTime(0, 0);
|
||||
$this->firstActiveDate = $firstActiveDay;
|
||||
|
||||
$lastActiveDay = new DateTime();
|
||||
$lastActiveDay->setTime(0, 0);
|
||||
$lastActiveDay->modify('+' . $this->countOfActiveDays . ' day');
|
||||
$this->lastActiveDate = $lastActiveDay;
|
||||
|
||||
$firstDisplayDate = new DateTime();
|
||||
$firstDisplayDate->modify('this week');
|
||||
$firstDisplayDate->setTime(0, 0);
|
||||
$this->firstDisplayDate = $firstDisplayDate;
|
||||
|
||||
$lastDisplayDate = clone $firstDisplayDate;
|
||||
$lastDisplayDate->setTime(0, 0);
|
||||
$lastDisplayDate->modify('+' . $this->daysToDisplay . ' day');
|
||||
$this->lastDisplayDate = $lastDisplayDate;
|
||||
|
||||
}
|
||||
|
||||
public static function createInterval(){
|
||||
return new EventInterval();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user