@@ -13,112 +13,112 @@ |
||
| 13 | 13 | class TimeBuilder |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** @param string $unit */ |
|
| 17 | - private string $unit; |
|
| 18 | - |
|
| 19 | - /** @param int $value */ |
|
| 20 | - private int $value; |
|
| 21 | - |
|
| 22 | - /** @param Closure $callback */ |
|
| 23 | - private Closure $callback; |
|
| 24 | - |
|
| 25 | - /** @param FileOptionBuilder */ |
|
| 26 | - private $builder = null; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * TimeBuilder constructor. |
|
| 30 | - * @param Closure $callback |
|
| 31 | - * @param FileOptionBuilder $builder |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function __construct(Closure $callback, $builder) |
|
| 36 | - { |
|
| 16 | + /** @param string $unit */ |
|
| 17 | + private string $unit; |
|
| 18 | + |
|
| 19 | + /** @param int $value */ |
|
| 20 | + private int $value; |
|
| 21 | + |
|
| 22 | + /** @param Closure $callback */ |
|
| 23 | + private Closure $callback; |
|
| 24 | + |
|
| 25 | + /** @param FileOptionBuilder */ |
|
| 26 | + private $builder = null; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * TimeBuilder constructor. |
|
| 30 | + * @param Closure $callback |
|
| 31 | + * @param FileOptionBuilder $builder |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function __construct(Closure $callback, $builder) |
|
| 36 | + { |
|
| 37 | 37 | $this->callback = $callback; |
| 38 | 38 | $this->builder = $builder; |
| 39 | - } |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Sets the time in seconds. |
|
| 43 | - * |
|
| 44 | - * @param int $seconds |
|
| 45 | - * @return FileOptionBuilder|mixed |
|
| 46 | - */ |
|
| 47 | - public function second(int $seconds) |
|
| 48 | - { |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Sets the time in seconds. |
|
| 43 | + * |
|
| 44 | + * @param int $seconds |
|
| 45 | + * @return FileOptionBuilder|mixed |
|
| 46 | + */ |
|
| 47 | + public function second(int $seconds) |
|
| 48 | + { |
|
| 49 | 49 | return $this->setTime($seconds, "seconds"); |
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Sets the time in minutes. |
|
| 54 | - * |
|
| 55 | - * @param int $minutes |
|
| 56 | - * @return FileOptionBuilder|mixed |
|
| 57 | - */ |
|
| 58 | - public function minute(int $minutes) |
|
| 59 | - { |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Sets the time in minutes. |
|
| 54 | + * |
|
| 55 | + * @param int $minutes |
|
| 56 | + * @return FileOptionBuilder|mixed |
|
| 57 | + */ |
|
| 58 | + public function minute(int $minutes) |
|
| 59 | + { |
|
| 60 | 60 | return $this->setTime($minutes, "minutes"); |
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Sets the time in hours. |
|
| 65 | - * |
|
| 66 | - * @param int $hours |
|
| 67 | - * @return FileOptionBuilder|mixed |
|
| 68 | - */ |
|
| 69 | - public function hour(int $hours) |
|
| 70 | - { |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Sets the time in hours. |
|
| 65 | + * |
|
| 66 | + * @param int $hours |
|
| 67 | + * @return FileOptionBuilder|mixed |
|
| 68 | + */ |
|
| 69 | + public function hour(int $hours) |
|
| 70 | + { |
|
| 71 | 71 | return $this->setTime($hours, "hours"); |
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Sets the time in days. |
|
| 76 | - * |
|
| 77 | - * @param int $days |
|
| 78 | - * @return FileOptionBuilder|mixed |
|
| 79 | - */ |
|
| 80 | - public function day(int $days) |
|
| 81 | - { |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Sets the time in days. |
|
| 76 | + * |
|
| 77 | + * @param int $days |
|
| 78 | + * @return FileOptionBuilder|mixed |
|
| 79 | + */ |
|
| 80 | + public function day(int $days) |
|
| 81 | + { |
|
| 82 | 82 | return $this->setTime($days, "days"); |
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Sets the time in weeks. |
|
| 87 | - * |
|
| 88 | - * @param int $weeks |
|
| 89 | - * @return FileOptionBuilder|mixed |
|
| 90 | - */ |
|
| 91 | - public function week(int $weeks) |
|
| 92 | - { |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Sets the time in weeks. |
|
| 87 | + * |
|
| 88 | + * @param int $weeks |
|
| 89 | + * @return FileOptionBuilder|mixed |
|
| 90 | + */ |
|
| 91 | + public function week(int $weeks) |
|
| 92 | + { |
|
| 93 | 93 | return $this->setTime($weeks, "weeks"); |
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Sets the time in months. |
|
| 98 | - * |
|
| 99 | - * @param int $months |
|
| 100 | - * @return FileOptionBuilder|mixed |
|
| 101 | - */ |
|
| 102 | - public function month(int $months) |
|
| 103 | - { |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Sets the time in months. |
|
| 98 | + * |
|
| 99 | + * @param int $months |
|
| 100 | + * @return FileOptionBuilder|mixed |
|
| 101 | + */ |
|
| 102 | + public function month(int $months) |
|
| 103 | + { |
|
| 104 | 104 | return $this->setTime($months, "months"); |
| 105 | - } |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * This method sets the time value and unit, and invokes the callback with the formatted string. |
|
| 110 | - * |
|
| 111 | - * @param int $value |
|
| 112 | - * @param string $unit |
|
| 113 | - * @return FileOptionBuilder |
|
| 114 | - */ |
|
| 115 | - private function setTime(int $value, string $unit) |
|
| 116 | - { |
|
| 108 | + /** |
|
| 109 | + * This method sets the time value and unit, and invokes the callback with the formatted string. |
|
| 110 | + * |
|
| 111 | + * @param int $value |
|
| 112 | + * @param string $unit |
|
| 113 | + * @return FileOptionBuilder |
|
| 114 | + */ |
|
| 115 | + private function setTime(int $value, string $unit) |
|
| 116 | + { |
|
| 117 | 117 | |
| 118 | 118 | $this->value = $value; |
| 119 | 119 | $this->unit = $unit; |
| 120 | - ($this->callback)("{$value} {$unit}"); |
|
| 120 | + ($this->callback)("{$value} {$unit}"); |
|
| 121 | 121 | return $this->builder; |
| 122 | - } |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | } |