@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @return string|null |
52 | 52 | */ |
53 | - public static function getParameterClassName($parameter): string|null |
|
53 | + public static function getParameterClassName($parameter): string | null |
|
54 | 54 | { |
55 | 55 | $type = $parameter->getType(); |
56 | 56 |
@@ -168,61 +168,61 @@ |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | - * Magic method. |
|
171 | + * Magic method. |
|
172 | 172 | * |
173 | 173 | * Searches for the given variable and returns its value. |
174 | - * |
|
175 | - * @param string $key Variable name |
|
176 | - * |
|
177 | - * @return mixed |
|
178 | - */ |
|
179 | - public function __get($key) |
|
180 | - { |
|
181 | - return $this->get($key); |
|
182 | - } |
|
183 | - |
|
184 | - /** |
|
185 | - * Magic method. |
|
174 | + * |
|
175 | + * @param string $key Variable name |
|
176 | + * |
|
177 | + * @return mixed |
|
178 | + */ |
|
179 | + public function __get($key) |
|
180 | + { |
|
181 | + return $this->get($key); |
|
182 | + } |
|
183 | + |
|
184 | + /** |
|
185 | + * Magic method. |
|
186 | 186 | * |
187 | 187 | * Calls [$this->set] with the same parameters. |
188 | - * |
|
189 | - * @param string $key Variable name |
|
190 | - * @param mixed $value Value |
|
191 | - * |
|
192 | - * @return void |
|
193 | - */ |
|
194 | - public function __set($key, $value) |
|
195 | - { |
|
196 | - $this->offsetSet($key, $value); |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * Magic method. |
|
188 | + * |
|
189 | + * @param string $key Variable name |
|
190 | + * @param mixed $value Value |
|
191 | + * |
|
192 | + * @return void |
|
193 | + */ |
|
194 | + public function __set($key, $value) |
|
195 | + { |
|
196 | + $this->offsetSet($key, $value); |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * Magic method. |
|
201 | 201 | * |
202 | 202 | * Determines if a variable is set. |
203 | - * |
|
204 | - * @param string $key variable name |
|
205 | - * |
|
206 | - * @return boolean |
|
207 | - */ |
|
208 | - public function __isset($key) |
|
209 | - { |
|
210 | - return $this->offsetExists($key); |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * Magic method. |
|
203 | + * |
|
204 | + * @param string $key variable name |
|
205 | + * |
|
206 | + * @return boolean |
|
207 | + */ |
|
208 | + public function __isset($key) |
|
209 | + { |
|
210 | + return $this->offsetExists($key); |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * Magic method. |
|
215 | 215 | * |
216 | 216 | * Unsets a given variable. |
217 | - * |
|
218 | - * @param string $key Variable name |
|
219 | - * |
|
220 | - * @return void |
|
221 | - */ |
|
222 | - public function __unset($key) |
|
223 | - { |
|
224 | - $this->offsetUnset($$key); |
|
225 | - } |
|
217 | + * |
|
218 | + * @param string $key Variable name |
|
219 | + * |
|
220 | + * @return void |
|
221 | + */ |
|
222 | + public function __unset($key) |
|
223 | + { |
|
224 | + $this->offsetUnset($$key); |
|
225 | + } |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Magic method. |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function replace($replaceMap, $keepMap, $rules): Closure |
73 | 73 | { |
74 | - return function ($word) use ($replaceMap, $keepMap, $rules) { |
|
74 | + return function($word) use ($replaceMap, $keepMap, $rules) { |
|
75 | 75 | $token = strtolower($word); |
76 | 76 | |
77 | 77 | if (array_key_exists($token, $keepMap)) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function checkWord($replaceMap, $keepMap, $rules): Closure |
99 | 99 | { |
100 | - return function ($word) use ($replaceMap, $keepMap, $rules) { |
|
100 | + return function($word) use ($replaceMap, $keepMap, $rules) { |
|
101 | 101 | $token = strtolower($word); |
102 | 102 | |
103 | 103 | if (array_key_exists($token, $keepMap)) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function replaceWord($word, $rule): string |
124 | 124 | { |
125 | - return preg_replace_callback($rule[0], function ($matches) use ($word, $rule) { |
|
125 | + return preg_replace_callback($rule[0], function($matches) use ($word, $rule) { |
|
126 | 126 | if ( ! isset($matches[0])) { |
127 | 127 | return $word; |
128 | 128 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function interpolate($str, $args) |
150 | 150 | { |
151 | - return preg_replace_callback('/\$(\d{1,2})/', function ($matches) use ($args) { |
|
151 | + return preg_replace_callback('/\$(\d{1,2})/', function($matches) use ($args) { |
|
152 | 152 | return isset($matches[1], $args[$matches[1]]) |
153 | 153 | ? $args[$matches[1]] |
154 | 154 | : ""; |
@@ -89,7 +89,7 @@ |
||
89 | 89 | */ |
90 | 90 | function dd() |
91 | 91 | { |
92 | - array_map(fn ($x) => var_dump($x), func_get_args()); |
|
92 | + array_map(fn ($x) => var_dump($x), func_get_args()); |
|
93 | 93 | |
94 | 94 | die(1); |
95 | 95 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | try { |
47 | 47 | return $object->{$method}(...$parameters); |
48 | - } catch (Error|BadMethodCallException $e) { |
|
48 | + } catch (Error | BadMethodCallException $e) { |
|
49 | 49 | static::BadMethodCallException($method); |
50 | 50 | } |
51 | 51 | } |
@@ -248,7 +248,9 @@ |
||
248 | 248 | */ |
249 | 249 | public static function limit($value, $limit, $end = '...'): string |
250 | 250 | { |
251 | - if (static::length($value) <= $limit) return $value; |
|
251 | + if (static::length($value) <= $limit) { |
|
252 | + return $value; |
|
253 | + } |
|
252 | 254 | |
253 | 255 | return rtrim(mb_substr($value, 0, $limit, 'UTF-8')).$end; |
254 | 256 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | { |
43 | 43 | $testTime = $this->getConvertedUTC($time, $timezone); |
44 | 44 | $ourTime = $this->toDateTime() |
45 | - ->setTimezone(new DateTimeZone('UTC')) |
|
46 | - ->format('Y-m-d H:i:s'); |
|
45 | + ->setTimezone(new DateTimeZone('UTC')) |
|
46 | + ->format('Y-m-d H:i:s'); |
|
47 | 47 | |
48 | 48 | return $testTime->format('Y-m-d H:i:s') === $ourTime; |
49 | 49 | } |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | return $testTime < $ourTime; |
66 | 66 | } |
67 | 67 | |
68 | - /** |
|
69 | - * Determines if the current instance's time is after test time, |
|
70 | - * after converting to UTC. |
|
71 | - * |
|
72 | - * @param \DateTime|string $time |
|
73 | - * @param \DatetimeZone|string|null $timezone |
|
74 | - * |
|
75 | - * @return bool |
|
76 | - */ |
|
68 | + /** |
|
69 | + * Determines if the current instance's time is after test time, |
|
70 | + * after converting to UTC. |
|
71 | + * |
|
72 | + * @param \DateTime|string $time |
|
73 | + * @param \DatetimeZone|string|null $timezone |
|
74 | + * |
|
75 | + * @return bool |
|
76 | + */ |
|
77 | 77 | public function isAfter($time, string $timezone = null): bool |
78 | 78 | { |
79 | 79 | $testTime = $this->getConvertedUTC($time, $timezone)->getTimestamp(); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | $this->timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); |
64 | 64 | |
65 | 65 | if ( ! empty($time)) { |
66 | - if (is_string($time) && static::hasRelativeKeywords($time)) { |
|
67 | - $dateTime = new DateTime('now', $this->timezone); |
|
68 | - $dateTime->modify($time); |
|
66 | + if (is_string($time) && static::hasRelativeKeywords($time)) { |
|
67 | + $dateTime = new DateTime('now', $this->timezone); |
|
68 | + $dateTime->modify($time); |
|
69 | 69 | |
70 | - $time = $dateTime->format('Y-m-d H:i:s'); |
|
71 | - } |
|
70 | + $time = $dateTime->format('Y-m-d H:i:s'); |
|
71 | + } |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return parent::__construct($time, $this->timezone); |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @return \Syscodes\Components\Support\Chronos\Time |
124 | 124 | */ |
125 | 125 | public static function yesterday($timezone = null, string $locale = null) |
126 | - { |
|
127 | - return static::parse(date('Y-m-d 00:00:00', strtotime('-1 day')), $timezone, $locale); |
|
126 | + { |
|
127 | + return static::parse(date('Y-m-d 00:00:00', strtotime('-1 day')), $timezone, $locale); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * @return \Syscodes\Components\Support\Chronos\Time |
137 | 137 | */ |
138 | 138 | public static function tomorrow($timezone = null, string $locale = null) |
139 | - { |
|
140 | - return static::parse(date('Y-m-d 00:00:00', strtotime('+1 day')), $timezone, $locale); |
|
139 | + { |
|
140 | + return static::parse(date('Y-m-d 00:00:00', strtotime('+1 day')), $timezone, $locale); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Creates an instance of Time that will be returned during testing |
272 | - * when calling 'Time::now' instead of the current time. |
|
272 | + * when calling 'Time::now' instead of the current time. |
|
273 | 273 | * |
274 | 274 | * @param \Syscodes\Components\Support\Chronos\Time|string $datetime |
275 | 275 | * @param string|null $timezone |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Returns boolean whether the passed timezone is the same as |
105 | - * the local timezone. |
|
105 | + * the local timezone. |
|
106 | 106 | * |
107 | 107 | * @return bool |
108 | 108 | */ |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | return $this->toLocalizedFormatter('yyyy-MM-dd'); |
204 | 204 | } |
205 | 205 | |
206 | - /** |
|
207 | - * Returns a localized version of the time in nicer date format. |
|
208 | - * |
|
209 | - * @return string |
|
210 | - */ |
|
206 | + /** |
|
207 | + * Returns a localized version of the time in nicer date format. |
|
208 | + * |
|
209 | + * @return string |
|
210 | + */ |
|
211 | 211 | public function toTimeString() |
212 | 212 | { |
213 | 213 | return $this->toLocalizedFormatter('HH:mm:ss'); |