@@ -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 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function _pre_get_json($id) |
| 151 | 151 | { |
| 152 | 152 | $userClass = Defaults::$userIdentifierClass; |
| 153 | - $this->cacheName = $userClass::getCacheIdentifier() . '_resources_' . $id; |
|
| 153 | + $this->cacheName = $userClass::getCacheIdentifier().'_resources_'.$id; |
|
| 154 | 154 | if ($this->restler->getProductionMode() |
| 155 | 155 | && !$this->restler->refreshCache |
| 156 | 156 | && $this->restler->cache->isCached($this->cacheName) |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | $routes |
| 218 | 218 | = Util::nestedValue(Routes::toArray(), "v$version") |
| 219 | - ? : array(); |
|
| 219 | + ?: array(); |
|
| 220 | 220 | |
| 221 | 221 | $prefix = Defaults::$useUrlBasedVersioning ? "/v$version" : ''; |
| 222 | 222 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | $fLen = strlen($fullPath); |
| 233 | 233 | if ($tSlash) { |
| 234 | - if ($fLen != $tLen && !Text::beginsWith($fullPath, $target . '/')) |
|
| 234 | + if ($fLen != $tLen && !Text::beginsWith($fullPath, $target.'/')) |
|
| 235 | 235 | continue; |
| 236 | 236 | } elseif ($fLen > $tLen + 1 && $fullPath[$tLen + 1] != '{' && !Text::beginsWith($fullPath, '{')) { |
| 237 | 237 | //when mapped to root exclude paths that have static parts |
@@ -290,21 +290,21 @@ discard block |
||
| 290 | 290 | $description = isset( |
| 291 | 291 | $m['classDescription']) |
| 292 | 292 | ? $m['classDescription'] |
| 293 | - : $className . ' API'; |
|
| 293 | + : $className.' API'; |
|
| 294 | 294 | if (empty($m['description'])) { |
| 295 | 295 | $m['description'] = $this->restler->getProductionMode() |
| 296 | 296 | ? '' |
| 297 | 297 | : 'routes to <mark>' |
| 298 | 298 | . $route['className'] |
| 299 | 299 | . '::' |
| 300 | - . $route['methodName'] . '();</mark>'; |
|
| 300 | + . $route['methodName'].'();</mark>'; |
|
| 301 | 301 | } |
| 302 | 302 | if (empty($m['longDescription'])) { |
| 303 | 303 | $m['longDescription'] = $this->restler->getProductionMode() |
| 304 | 304 | ? '' |
| 305 | 305 | : 'Add PHPDoc long description to ' |
| 306 | 306 | . "<mark>$className::" |
| 307 | - . $route['methodName'] . '();</mark>' |
|
| 307 | + . $route['methodName'].'();</mark>' |
|
| 308 | 308 | . ' (the api method) to write here'; |
| 309 | 309 | } |
| 310 | 310 | $operation = $this->_operation( |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | ['type']; |
| 360 | 360 | if (class_exists($rt)) { |
| 361 | 361 | $this->_model($rt); |
| 362 | - $operation->responseClass .= '[' . |
|
| 363 | - $this->_noNamespace($rt) . ']'; |
|
| 362 | + $operation->responseClass .= '['. |
|
| 363 | + $this->_noNamespace($rt).']'; |
|
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | } |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $r->models = $this->_models; |
| 393 | 393 | usort( |
| 394 | 394 | $r->apis, |
| 395 | - function ($a, $b) { |
|
| 395 | + function($a, $b) { |
|
| 396 | 396 | $order = array( |
| 397 | 397 | 'GET' => 1, |
| 398 | 398 | 'POST' => 2, |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | protected function _resourceListing() |
| 451 | 451 | { |
| 452 | 452 | $r = new stdClass(); |
| 453 | - $r->apiVersion = (string)$this->restler->_requestedApiVersion; |
|
| 453 | + $r->apiVersion = (string) $this->restler->_requestedApiVersion; |
|
| 454 | 454 | $r->swaggerVersion = "1.1"; |
| 455 | 455 | $r->basePath = $this->restler->getBaseUrl(); |
| 456 | 456 | $r->produces = $this->restler->getWritableMimeTypes(); |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | $r->parameters = array(); |
| 495 | 495 | |
| 496 | - $r->summary = $summary . ($route['accessLevel'] > 2 |
|
| 496 | + $r->summary = $summary.($route['accessLevel'] > 2 |
|
| 497 | 497 | ? static::$apiDescriptionSuffixSymbols[2] |
| 498 | 498 | : static::$apiDescriptionSuffixSymbols[$route['accessLevel']] |
| 499 | 499 | ); |
@@ -508,13 +508,13 @@ discard block |
||
| 508 | 508 | $r = new stdClass(); |
| 509 | 509 | $r->name = $param['name']; |
| 510 | 510 | $r->description = !empty($param['description']) |
| 511 | - ? $param['description'] . '.' |
|
| 511 | + ? $param['description'].'.' |
|
| 512 | 512 | : ($this->restler->getProductionMode() |
| 513 | 513 | ? '' |
| 514 | - : 'add <mark>@param {type} $' . $r->name |
|
| 514 | + : 'add <mark>@param {type} $'.$r->name |
|
| 515 | 515 | . ' {comment}</mark> to describe here'); |
| 516 | 516 | //paramType can be path or query or body or header |
| 517 | - $r->paramType = Util::nestedValue($param, CommentParser::$embeddedDataName, 'from') ? : 'query'; |
|
| 517 | + $r->paramType = Util::nestedValue($param, CommentParser::$embeddedDataName, 'from') ?: 'query'; |
|
| 518 | 518 | $r->required = isset($param['required']) && $param['required']; |
| 519 | 519 | if (isset($param['default'])) { |
| 520 | 520 | $r->defaultValue = $param['default']; |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | } |
| 584 | 584 | $this->_bodyParam['description'][$p->name] |
| 585 | 585 | = "$p->name" |
| 586 | - . ' : <tag>' . $p->dataType . '</tag> ' |
|
| 586 | + . ' : <tag>'.$p->dataType.'</tag> ' |
|
| 587 | 587 | . ($p->required ? ' <i>(required)</i> - ' : ' - ') |
| 588 | 588 | . $p->description; |
| 589 | 589 | $this->_bodyParam['required'] = $p->required |
@@ -609,9 +609,9 @@ discard block |
||
| 609 | 609 | . (count($a) > 1 ? ' properties.' : ' property.'); |
| 610 | 610 | foreach ($a as $k => $v) { |
| 611 | 611 | $r->description .= "<hr/>$k : <tag>" |
| 612 | - . $v['type'] . '</tag> ' |
|
| 612 | + . $v['type'].'</tag> ' |
|
| 613 | 613 | . (isset($v['required']) ? '(required)' : '') |
| 614 | - . ' - ' . $v['description']; |
|
| 614 | + . ' - '.$v['description']; |
|
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | $r->defaultValue = "{\n \"" |
@@ -631,9 +631,9 @@ discard block |
||
| 631 | 631 | . (count($a) > 1 ? ' properties.' : ' property.'); |
| 632 | 632 | foreach ($a as $k => $v) { |
| 633 | 633 | $r->description .= "<hr/>$k : <tag>" |
| 634 | - . $v['type'] . '</tag> ' |
|
| 634 | + . $v['type'].'</tag> ' |
|
| 635 | 635 | . (isset($v['required']) ? '(required)' : '') |
| 636 | - . ' - ' . $v['description']; |
|
| 636 | + . ' - '.$v['description']; |
|
| 637 | 637 | } |
| 638 | 638 | } |
| 639 | 639 | $r->defaultValue = "[\n {\n \"" |
@@ -734,11 +734,11 @@ discard block |
||
| 734 | 734 | $type = Util::nestedValue( |
| 735 | 735 | $propertyMetaData, |
| 736 | 736 | 'type' |
| 737 | - ) ? : $this->getType($value, true); |
|
| 737 | + ) ?: $this->getType($value, true); |
|
| 738 | 738 | $description = Util::nestedValue( |
| 739 | 739 | $propertyMetaData, |
| 740 | 740 | 'description' |
| 741 | - ) ? : ''; |
|
| 741 | + ) ?: ''; |
|
| 742 | 742 | |
| 743 | 743 | if (class_exists($type)) { |
| 744 | 744 | $this->_model($type); |
@@ -766,8 +766,7 @@ discard block |
||
| 766 | 766 | $propertyMetaData, |
| 767 | 767 | CommentParser::$embeddedDataName, |
| 768 | 768 | 'type' |
| 769 | - ) ? : |
|
| 770 | - (count($value) |
|
| 769 | + ) ?: (count($value) |
|
| 771 | 770 | ? $this->getType(end($value), true) |
| 772 | 771 | : 'string'); |
| 773 | 772 | if (class_exists($itemType)) { |
@@ -894,7 +893,7 @@ discard block |
||
| 894 | 893 | if (!Text::contains($path, '{')) { |
| 895 | 894 | //add id |
| 896 | 895 | $r->apis[] = array( |
| 897 | - 'path' => $path . $this->formatString, |
|
| 896 | + 'path' => $path.$this->formatString, |
|
| 898 | 897 | 'description' => $description |
| 899 | 898 | ); |
| 900 | 899 | } |
@@ -915,8 +914,8 @@ discard block |
||
| 915 | 914 | |
| 916 | 915 | protected function _loadResource($url) |
| 917 | 916 | { |
| 918 | - $ch = curl_init($this->restler->getBaseUrl() . $url |
|
| 919 | - . (empty($_GET) ? '' : '?' . http_build_query($_GET))); |
|
| 917 | + $ch = curl_init($this->restler->getBaseUrl().$url |
|
| 918 | + . (empty($_GET) ? '' : '?'.http_build_query($_GET))); |
|
| 920 | 919 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); |
| 921 | 920 | curl_setopt($ch, CURLOPT_TIMEOUT, 15); |
| 922 | 921 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
@@ -925,7 +924,7 @@ discard block |
||
| 925 | 924 | )); |
| 926 | 925 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
| 927 | 926 | $result = json_decode(curl_exec($ch)); |
| 928 | - $http_status = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
| 927 | + $http_status = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
| 929 | 928 | return array($http_status, $result); |
| 930 | 929 | } |
| 931 | 930 | |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public static function register($name, $function, $singleton = true) |
| 82 | 82 | { |
| 83 | - static::$registry[$name] = (object)compact('function', 'singleton'); |
|
| 83 | + static::$registry[$name] = (object) compact('function', 'singleton'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public static function set($name, $instance) |
| 87 | 87 | { |
| 88 | - static::$instances[$name] = (object)array('instance' => $instance); |
|
| 88 | + static::$instances[$name] = (object) array('instance' => $instance); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public static function get($name) |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $function = static::$registry[$name]->function; |
| 101 | 101 | $r = $function(); |
| 102 | 102 | if (static::$registry[$name]->singleton) { |
| 103 | - static::$instances[$name] = (object)array('instance' => $r); |
|
| 103 | + static::$instances[$name] = (object) array('instance' => $r); |
|
| 104 | 104 | } |
| 105 | 105 | } elseif (is_callable(static::$resolver) && false === stristr($name, 'Luracast\Restler')) { |
| 106 | 106 | $fullName = $name; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /** @var Callable $function */ |
| 111 | 111 | $function = static::$resolver; |
| 112 | 112 | $r = $function($fullName); |
| 113 | - static::$instances[$name] = (object)array('instance' => $r); |
|
| 113 | + static::$instances[$name] = (object) array('instance' => $r); |
|
| 114 | 114 | static::$instances[$name]->initPending = true; |
| 115 | 115 | } else { |
| 116 | 116 | $fullName = $name; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | if (class_exists($fullName)) { |
| 121 | 121 | $shortName = Util::getShortName($name); |
| 122 | 122 | $r = new $fullName(); |
| 123 | - static::$instances[$name] = (object)array('instance' => $r); |
|
| 123 | + static::$instances[$name] = (object) array('instance' => $r); |
|
| 124 | 124 | if ($name != 'Restler') { |
| 125 | 125 | /** @var Restler restler */ |
| 126 | 126 | $r->restler = static::get('Restler'); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | } elseif (array_key_exists($className, $scope)) { |
| 211 | 211 | $qualified = $scope[$className]; |
| 212 | 212 | } else { |
| 213 | - $qualified = $scope['*'] . $className; |
|
| 213 | + $qualified = $scope['*'].$className; |
|
| 214 | 214 | } |
| 215 | 215 | if (class_exists($qualified)) { |
| 216 | 216 | return $qualified; |