| Total Complexity | 10 |
| Total Lines | 101 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class TimeRange |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Starting time. |
||
| 11 | * |
||
| 12 | * @var Carbon |
||
| 13 | */ |
||
| 14 | protected $start; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * End time. |
||
| 18 | * |
||
| 19 | * @var Carbon |
||
| 20 | */ |
||
| 21 | protected $end; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * TimeRange constructor. |
||
| 25 | * |
||
| 26 | * @param null $start |
||
|
|
|||
| 27 | * @param null $end |
||
| 28 | */ |
||
| 29 | public function __construct($start = null, $end = null) |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Set start time. |
||
| 37 | * |
||
| 38 | * @param $start |
||
| 39 | * |
||
| 40 | * @return $this |
||
| 41 | */ |
||
| 42 | public function start($start) |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Set end time. |
||
| 53 | * |
||
| 54 | * @param $end |
||
| 55 | * |
||
| 56 | * @return $this |
||
| 57 | */ |
||
| 58 | public function end($end) |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Check start time and end time. |
||
| 69 | * |
||
| 70 | * @throws \Exception |
||
| 71 | */ |
||
| 72 | protected function checkTimeRange() |
||
| 80 | } |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Get the instance as an array. |
||
| 85 | * |
||
| 86 | * @return array |
||
| 87 | */ |
||
| 88 | protected function __toArray() |
||
| 93 | ]; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Check timeCheck time and get the instance as an array. |
||
| 98 | * |
||
| 99 | * @throws \Exception |
||
| 100 | * |
||
| 101 | * @return array |
||
| 102 | */ |
||
| 103 | public function toArray() |
||
| 110 |