@@ -50,7 +50,7 @@ |
||
50 | 50 | public static $valueMap = [ |
51 | 51 | 'BINARY' => VObject\Property\Binary::class, |
52 | 52 | 'BOOLEAN' => VObject\Property\Boolean::class, |
53 | - 'CONTENT-ID' => VObject\Property\FlatText::class, // vCard 2.1 only |
|
53 | + 'CONTENT-ID' => VObject\Property\FlatText::class, // vCard 2.1 only |
|
54 | 54 | 'DATE' => VObject\Property\VCard\Date::class, |
55 | 55 | 'DATE-TIME' => VObject\Property\VCard\DateTime::class, |
56 | 56 | 'DATE-AND-OR-TIME' => VObject\Property\VCard\DateAndOrTime::class, // vCard only |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getBaseComponents($componentName = null) |
177 | 177 | { |
178 | - $isBaseComponent = function ($component) { |
|
178 | + $isBaseComponent = function($component) { |
|
179 | 179 | if (!$component instanceof VObject\Component) { |
180 | 180 | return false; |
181 | 181 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function getBaseComponent($componentName = null) |
228 | 228 | { |
229 | - $isBaseComponent = function ($component) { |
|
229 | + $isBaseComponent = function($component) { |
|
230 | 230 | if (!$component instanceof VObject\Component) { |
231 | 231 | return false; |
232 | 232 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $timeZone = new DateTimeZone('UTC'); |
291 | 291 | } |
292 | 292 | |
293 | - $stripTimezones = function (Component $component) use ($timeZone, &$stripTimezones) { |
|
293 | + $stripTimezones = function(Component $component) use ($timeZone, &$stripTimezones) { |
|
294 | 294 | foreach ($component->children() as $componentChild) { |
295 | 295 | if ($componentChild instanceof Property\ICalendar\DateTime && $componentChild->hasTime()) { |
296 | 296 | $dt = $componentChild->getDateTimes($timeZone); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | */ |
517 | 517 | public function getByUID($uid) |
518 | 518 | { |
519 | - return array_filter($this->getComponents(), function ($item) use ($uid) { |
|
519 | + return array_filter($this->getComponents(), function($item) use ($uid) { |
|
520 | 520 | if (!$itemUid = $item->select('UID')) { |
521 | 521 | return false; |
522 | 522 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | $base = parse($basePath); |
34 | - $pick = function ($part) use ($base, $delta) { |
|
34 | + $pick = function($part) use ($base, $delta) { |
|
35 | 35 | if ($delta[$part]) { |
36 | 36 | return $delta[$part]; |
37 | 37 | } elseif ($base[$part]) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // uriencode them first. |
188 | 188 | $uri = preg_replace_callback( |
189 | 189 | '/[^[:ascii:]]/u', |
190 | - function ($matches) { |
|
190 | + function($matches) { |
|
191 | 191 | return rawurlencode($matches[0]); |
192 | 192 | }, |
193 | 193 | $uri |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | // uriencode them first. |
317 | 317 | $uri = preg_replace_callback( |
318 | 318 | '/[^[:ascii:]]/u', |
319 | - function ($matches) { |
|
319 | + function($matches) { |
|
320 | 320 | return rawurlencode($matches[0]); |
321 | 321 | }, |
322 | 322 | $uri |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | */ |
387 | 387 | function encodePath(string $path): string |
388 | 388 | { |
389 | - return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\)\/:@])/', function ($match) { |
|
389 | + return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\)\/:@])/', function($match) { |
|
390 | 390 | return '%'.sprintf('%02x', ord($match[0])); |
391 | 391 | }, $path); |
392 | 392 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function encodePathSegment(string $pathSegment): string |
400 | 400 | { |
401 | - return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\):@])/', function ($match) { |
|
401 | + return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\):@])/', function($match) { |
|
402 | 402 | return '%'.sprintf('%02x', ord($match[0])); |
403 | 403 | }, $pathSegment); |
404 | 404 | } |
@@ -244,10 +244,10 @@ |
||
244 | 244 | { |
245 | 245 | list($namespace) = self::parseClarkNotation($elementName); |
246 | 246 | |
247 | - $this->elementMap[$elementName] = function (Reader $reader) use ($className, $namespace) { |
|
247 | + $this->elementMap[$elementName] = function(Reader $reader) use ($className, $namespace) { |
|
248 | 248 | return \Sabre\Xml\Deserializer\valueObject($reader, $className, $namespace); |
249 | 249 | }; |
250 | - $this->classMap[$className] = function (Writer $writer, $valueObject) use ($namespace) { |
|
250 | + $this->classMap[$className] = function(Writer $writer, $valueObject) use ($namespace) { |
|
251 | 251 | return \Sabre\Xml\Serializer\valueObject($writer, $valueObject, $namespace); |
252 | 252 | }; |
253 | 253 | $this->valueObjectMap[$className] = $elementName; |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $value = self::toArray($object->{$key}, |
87 | 87 | $forceObjectTypeWhenEmpty); |
88 | 88 | if (self::$stringEncoderFunction && is_string($value)) { |
89 | - $value = self::$stringEncoderFunction ($value); |
|
89 | + $value = self::$stringEncoderFunction($value); |
|
90 | 90 | } elseif (self::$numberEncoderFunction && is_numeric($value)) { |
91 | - $value = self::$numberEncoderFunction ($value); |
|
91 | + $value = self::$numberEncoderFunction($value); |
|
92 | 92 | } |
93 | 93 | $array [$key] = $value; |
94 | 94 | } |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | } |
122 | 122 | $value = self::toArray($value, $forceObjectTypeWhenEmpty); |
123 | 123 | if (self::$stringEncoderFunction && is_string($value)) { |
124 | - $value = self::$encoderFunctionName ($value); |
|
124 | + $value = self::$encoderFunctionName($value); |
|
125 | 125 | } elseif (self::$numberEncoderFunction && is_numeric($value)) { |
126 | - $value = self::$numberEncoderFunction ($value); |
|
126 | + $value = self::$numberEncoderFunction($value); |
|
127 | 127 | } |
128 | 128 | $array [$key] = $value; |
129 | 129 | $count++; |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __toString() |
20 | 20 | { |
21 | - return ' new ' . get_called_class() . '() '; |
|
21 | + return ' new '.get_called_class().'() '; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public static function __set_state(array $properties) |
25 | 25 | { |
26 | 26 | $class = get_called_class(); |
27 | - $instance = new $class (); |
|
27 | + $instance = new $class(); |
|
28 | 28 | $vars = get_object_vars($instance); |
29 | 29 | foreach ($properties as $property => $value) { |
30 | 30 | if (property_exists($instance, $property)) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if (array_key_exists($property, $vars)) { |
33 | 33 | $instance->{$property} = $value; |
34 | 34 | } else { |
35 | - $method = 'set' . ucfirst($property); |
|
35 | + $method = 'set'.ucfirst($property); |
|
36 | 36 | if (method_exists($instance, $method)) { |
37 | 37 | call_user_func(array( |
38 | 38 | $instance, |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | if (is_numeric($input) && '-' != substr($input, 0, 1)) { |
189 | 189 | return $input; |
190 | 190 | } |
191 | - throw new Invalid('Expecting phone number, a numeric value ' . |
|
191 | + throw new Invalid('Expecting phone number, a numeric value '. |
|
192 | 192 | 'with optional `+` prefix'); |
193 | 193 | } |
194 | 194 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | throw new Invalid( |
286 | 286 | 'Expecting date in `YYYY-MM-DD` format, such as `' |
287 | - . date("Y-m-d") . '`' |
|
287 | + . date("Y-m-d").'`' |
|
288 | 288 | ); |
289 | 289 | } |
290 | 290 | |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | public static function datetime($input, ValidationInfo $info = null) |
303 | 303 | { |
304 | 304 | if ( |
305 | - preg_match('/^(?P<year>19\d\d|20\d\d)\-(?P<month>0[1-9]|1[0-2])\-' . |
|
306 | - '(?P<day>0\d|[1-2]\d|3[0-1]) (?P<h>0\d|1\d|2[0-3]' . |
|
305 | + preg_match('/^(?P<year>19\d\d|20\d\d)\-(?P<month>0[1-9]|1[0-2])\-'. |
|
306 | + '(?P<day>0\d|[1-2]\d|3[0-1]) (?P<h>0\d|1\d|2[0-3]'. |
|
307 | 307 | ')\:(?P<i>[0-5][0-9])\:(?P<s>[0-5][0-9])$/', |
308 | 308 | $input, $date) |
309 | 309 | && checkdate($date['month'], $date['day'], $date['year']) |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | } |
313 | 313 | throw new Invalid( |
314 | 314 | 'Expecting date and time in `YYYY-MM-DD HH:MM:SS` format, such as `' |
315 | - . date("Y-m-d H:i:s") . '`' |
|
315 | + . date("Y-m-d H:i:s").'`' |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | } |
351 | 351 | throw new Invalid( |
352 | 352 | 'Expecting time in `HH:MM:SS` format, such as `' |
353 | - . date("H:i:s") . '`' |
|
353 | + . date("H:i:s").'`' |
|
354 | 354 | ); |
355 | 355 | } |
356 | 356 | |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public static function timestamp($input, ValidationInfo $info = null) |
393 | 393 | { |
394 | - if ((string)(int)$input == $input |
|
394 | + if ((string) (int) $input == $input |
|
395 | 395 | && ($input <= PHP_INT_MAX) |
396 | 396 | && ($input >= ~PHP_INT_MAX) |
397 | 397 | ) { |
398 | - return (int)$input; |
|
398 | + return (int) $input; |
|
399 | 399 | } |
400 | - throw new Invalid('Expecting unix timestamp, such as ' . time()); |
|
400 | + throw new Invalid('Expecting unix timestamp, such as '.time()); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | try { |
434 | 434 | if (is_null($input)) { |
435 | 435 | if ($info->required) { |
436 | - throw new RestException (400, |
|
436 | + throw new RestException(400, |
|
437 | 437 | "$name is required."); |
438 | 438 | } |
439 | 439 | return null; |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | // just continue |
466 | 466 | } |
467 | 467 | } |
468 | - throw new RestException (400, $error); |
|
468 | + throw new RestException(400, $error); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | //patterns are supported only for non numeric types |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | && $info->type != 'number' |
476 | 476 | ) { |
477 | 477 | if (!preg_match($info->pattern, $input)) { |
478 | - throw new RestException (400, $error); |
|
478 | + throw new RestException(400, $error); |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | |
@@ -486,13 +486,13 @@ discard block |
||
486 | 486 | } elseif (is_array($input)) { |
487 | 487 | foreach ($input as $i) { |
488 | 488 | if (!in_array($i, $info->choice)) { |
489 | - $error .= ". Expected one of (" . implode(',', $info->choice) . ")."; |
|
490 | - throw new RestException (400, $error); |
|
489 | + $error .= ". Expected one of (".implode(',', $info->choice).")."; |
|
490 | + throw new RestException(400, $error); |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | } elseif (!in_array($input, $info->choice)) { |
494 | - $error .= ". Expected one of (" . implode(',', $info->choice) . ")."; |
|
495 | - throw new RestException (400, $error); |
|
494 | + $error .= ". Expected one of (".implode(',', $info->choice).")."; |
|
495 | + throw new RestException(400, $error); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | try { |
505 | 505 | return call_user_func("$class::$info->type", $input, $info); |
506 | 506 | } catch (Invalid $e) { |
507 | - throw new RestException(400, $error . '. ' . $e->getMessage()); |
|
507 | + throw new RestException(400, $error.'. '.$e->getMessage()); |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | . ' value'; |
519 | 519 | break; |
520 | 520 | } |
521 | - if ($info->type == 'int' && (int)$input != $input) { |
|
521 | + if ($info->type == 'int' && (int) $input != $input) { |
|
522 | 522 | if ($info->fix) { |
523 | - $r = (int)$input; |
|
523 | + $r = (int) $input; |
|
524 | 524 | } else { |
525 | 525 | $error .= '. Expecting integer value'; |
526 | 526 | break; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | } |
664 | 664 | return $input; |
665 | 665 | } elseif (isset($contentType)) { |
666 | - $error .= '. Expecting items of type ' . |
|
666 | + $error .= '. Expecting items of type '. |
|
667 | 667 | ($html ? "<strong>$contentType</strong>" : "`$contentType`"); |
668 | 668 | break; |
669 | 669 | } |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | !is_array($input) || |
698 | 698 | $input === array_values($input) |
699 | 699 | ) { |
700 | - $error .= '. Expecting an item of type ' . |
|
700 | + $error .= '. Expecting an item of type '. |
|
701 | 701 | ($html ? "<strong>$info->type</strong>" : "`$info->type`"); |
702 | 702 | break; |
703 | 703 | } |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | return $instance; |
716 | 716 | } |
717 | 717 | } |
718 | - throw new RestException (400, $error); |
|
718 | + throw new RestException(400, $error); |
|
719 | 719 | } catch (\Exception $e) { |
720 | 720 | static::$exceptions[$info->name] = $e; |
721 | 721 | if (static::$holdException) { |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | |
173 | 173 | public static function numericValue($value) |
174 | 174 | { |
175 | - return ( int )$value == $value |
|
176 | - ? ( int )$value |
|
175 | + return (int) $value == $value |
|
176 | + ? (int) $value |
|
177 | 177 | : floatval($value); |
178 | 178 | } |
179 | 179 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | return is_array($value) |
190 | 190 | ? implode($glue, $value) |
191 | - : ( string )$value; |
|
191 | + : (string) $value; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | public static function booleanValue($value) |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public static function __set_state(array $info) |
268 | 268 | { |
269 | - $o = new self ($info); |
|
269 | + $o = new self($info); |
|
270 | 270 | return $o; |
271 | 271 | } |
272 | 272 | } |