@@ -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; |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | public function __construct($httpStatusCode, $errorMessage = null, array $details = array(), Exception $previous = null) |
81 | 81 | { |
82 | 82 | $events = Scope::get('Restler')->getEvents(); |
83 | - if(count($events)<= 1){ |
|
83 | + if (count($events) <= 1) { |
|
84 | 84 | $this->stage = 'setup'; |
85 | 85 | } else { |
86 | - $this->stage = $previous ? $events[count($events)-2] : end($events); |
|
86 | + $this->stage = $previous ? $events[count($events) - 2] : end($events); |
|
87 | 87 | } |
88 | 88 | $this->details = $details; |
89 | 89 | parent::__construct($errorMessage, $httpStatusCode, $previous); |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | $statusCode = $this->getCode(); |
120 | 120 | $message = $this->getMessage(); |
121 | 121 | if (isset(RestException::$codes[$statusCode])) { |
122 | - $message = RestException::$codes[$statusCode] . |
|
123 | - (empty($message) ? '' : ': ' . $message); |
|
122 | + $message = RestException::$codes[$statusCode]. |
|
123 | + (empty($message) ? '' : ': '.$message); |
|
124 | 124 | } |
125 | 125 | return $message; |
126 | 126 | } |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | while ($e->getPrevious()) { |
132 | 132 | $e = $e->getPrevious(); |
133 | 133 | } |
134 | - return basename($e->getFile()) . ':' |
|
135 | - . $e->getLine() . ' at ' |
|
136 | - . $this->getStage() . ' stage'; |
|
134 | + return basename($e->getFile()).':' |
|
135 | + . $e->getLine().' at ' |
|
136 | + . $this->getStage().' stage'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 |
@@ -27,6 +27,6 @@ |
||
27 | 27 | * |
28 | 28 | * @return mixed |
29 | 29 | */ |
30 | - public function __setAuthenticationStatus($isAuthenticated=false); |
|
30 | + public function __setAuthenticationStatus($isAuthenticated = false); |
|
31 | 31 | } |
32 | 32 |
@@ -63,9 +63,8 @@ discard block |
||
63 | 63 | function_exists('memcache_set') || $this->memcacheNotAvailable(); |
64 | 64 | |
65 | 65 | try { |
66 | - return $this->memcache->set(self::$namespace . "-" . $name, $data); |
|
67 | - } catch |
|
68 | - (\Exception $exception) { |
|
66 | + return $this->memcache->set(self::$namespace."-".$name, $data); |
|
67 | + } catch (\Exception $exception) { |
|
69 | 68 | return false; |
70 | 69 | } |
71 | 70 | } |
@@ -90,7 +89,7 @@ discard block |
||
90 | 89 | function_exists('memcache_get') || $this->memcacheNotAvailable(); |
91 | 90 | |
92 | 91 | try { |
93 | - return $this->memcache->get(self::$namespace . "-" . $name); |
|
92 | + return $this->memcache->get(self::$namespace."-".$name); |
|
94 | 93 | } catch (\Exception $exception) { |
95 | 94 | if (!$ignoreErrors) { |
96 | 95 | throw $exception; |
@@ -114,7 +113,7 @@ discard block |
||
114 | 113 | function_exists('memcache_delete') || $this->memcacheNotAvailable(); |
115 | 114 | |
116 | 115 | try { |
117 | - $this->memcache->delete(self::$namespace . "-" . $name); |
|
116 | + $this->memcache->delete(self::$namespace."-".$name); |
|
118 | 117 | } catch (\Exception $exception) { |
119 | 118 | if (!$ignoreErrors) { |
120 | 119 | throw $exception; |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | public function isCached($name) |
134 | 133 | { |
135 | 134 | function_exists('memcache_get') || $this->memcacheNotAvailable(); |
136 | - $data = $this->memcache->get(self::$namespace . "-" . $name); |
|
135 | + $data = $this->memcache->get(self::$namespace."-".$name); |
|
137 | 136 | return !empty($data); |
138 | 137 | } |
139 | 138 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @var int|null when specified it will override @status comment |
112 | 112 | */ |
113 | - public $responseCode=null; |
|
113 | + public $responseCode = null; |
|
114 | 114 | /** |
115 | 115 | * @var string base url of the api service |
116 | 116 | */ |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | Scope::set('Restler', $this); |
247 | 247 | $this->productionMode = $productionMode; |
248 | 248 | if (is_null(Defaults::$cacheDirectory)) { |
249 | - Defaults::$cacheDirectory = dirname($_SERVER['SCRIPT_FILENAME']) . |
|
250 | - DIRECTORY_SEPARATOR . 'cache'; |
|
249 | + Defaults::$cacheDirectory = dirname($_SERVER['SCRIPT_FILENAME']). |
|
250 | + DIRECTORY_SEPARATOR.'cache'; |
|
251 | 251 | } |
252 | 252 | $this->cache = new Defaults::$cacheClass(); |
253 | 253 | $this->refreshCache = $refreshCache; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | $this->respond(); |
315 | 315 | } catch (Exception $e) { |
316 | - try{ |
|
316 | + try { |
|
317 | 317 | if (Defaults::$returnResponse) { |
318 | 318 | return $this->message($e); |
319 | 319 | } |
@@ -402,19 +402,19 @@ discard block |
||
402 | 402 | $obj = Scope::get($className); |
403 | 403 | |
404 | 404 | if (!$obj instanceof iFormat) |
405 | - throw new Exception('Invalid format class; must implement ' . |
|
405 | + throw new Exception('Invalid format class; must implement '. |
|
406 | 406 | 'iFormat interface'); |
407 | 407 | if ($throwException && get_class($obj) == get_class($this->requestFormat)) { |
408 | 408 | $throwException = false; |
409 | 409 | } |
410 | 410 | |
411 | 411 | foreach ($obj->getMIMEMap() as $mime => $extension) { |
412 | - if($obj->isWritable()){ |
|
413 | - $this->writableMimeTypes[]=$mime; |
|
412 | + if ($obj->isWritable()) { |
|
413 | + $this->writableMimeTypes[] = $mime; |
|
414 | 414 | $extensions[".$extension"] = true; |
415 | 415 | } |
416 | - if($obj->isReadable()) |
|
417 | - $this->readableMimeTypes[]=$mime; |
|
416 | + if ($obj->isReadable()) |
|
417 | + $this->readableMimeTypes[] = $mime; |
|
418 | 418 | if (!isset($this->formatMap[$extension])) |
419 | 419 | $this->formatMap[$extension] = $className; |
420 | 420 | if (!isset($this->formatMap[$mime])) |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | if ($throwException) { |
425 | 425 | throw new RestException( |
426 | 426 | 403, |
427 | - 'Content type `' . $this->requestFormat->getMIME() . '` is not supported.' |
|
427 | + 'Content type `'.$this->requestFormat->getMIME().'` is not supported.' |
|
428 | 428 | ); |
429 | 429 | } |
430 | 430 | $this->formatMap['default'] = $args[0]; |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $obj = Scope::get($className); |
451 | 451 | |
452 | 452 | if (!$obj instanceof iFormat) |
453 | - throw new Exception('Invalid format class; must implement ' . |
|
453 | + throw new Exception('Invalid format class; must implement '. |
|
454 | 454 | 'iFormat interface'); |
455 | 455 | |
456 | 456 | foreach ($obj->getMIMEMap() as $mime => $extension) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $this->formatOverridesMap[$extension] = $className; |
459 | 459 | if (!isset($this->formatOverridesMap[$mime])) |
460 | 460 | $this->formatOverridesMap[$mime] = $className; |
461 | - if($obj->isWritable()) |
|
461 | + if ($obj->isWritable()) |
|
462 | 462 | $extensions[".$extension"] = true; |
463 | 463 | } |
464 | 464 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | if (func_num_args() > 1) { |
479 | 479 | $urls = func_get_args(); |
480 | - usort($urls, function ($a, $b) { |
|
480 | + usort($urls, function($a, $b) { |
|
481 | 481 | return strlen($a) - strlen($b); |
482 | 482 | }); |
483 | 483 | foreach ($urls as $u) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | // fix SCRIPT_NAME for PHP 5.4 built-in web server |
501 | 501 | if (false === strpos($_SERVER['SCRIPT_NAME'], '.php')) |
502 | 502 | $_SERVER['SCRIPT_NAME'] |
503 | - = '/' . substr($_SERVER['SCRIPT_FILENAME'], strlen($_SERVER['DOCUMENT_ROOT']) + 1); |
|
503 | + = '/'.substr($_SERVER['SCRIPT_FILENAME'], strlen($_SERVER['DOCUMENT_ROOT']) + 1); |
|
504 | 504 | |
505 | 505 | list($base, $path) = Util::splitCommonPath( |
506 | 506 | strtok(urldecode($_SERVER['REQUEST_URI']), '?'), //remove query string |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | if (!$this->baseUrl) { |
511 | 511 | // Fix port number retrieval if port is specified in HOST header. |
512 | 512 | $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; |
513 | - $portPos = strpos($host,":"); |
|
514 | - if ($portPos){ |
|
515 | - $port = substr($host,$portPos+1); |
|
513 | + $portPos = strpos($host, ":"); |
|
514 | + if ($portPos) { |
|
515 | + $port = substr($host, $portPos + 1); |
|
516 | 516 | } else { |
517 | 517 | $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '80'; |
518 | 518 | $port = isset($_SERVER['HTTP_X_FORWARDED_PORT']) ? $_SERVER['HTTP_X_FORWARDED_PORT'] : $port; // Amazon ELB |
@@ -520,10 +520,10 @@ discard block |
||
520 | 520 | $https = $port == '443' || |
521 | 521 | (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') || // Amazon ELB |
522 | 522 | (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'); |
523 | - $baseUrl = ($https ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']; |
|
523 | + $baseUrl = ($https ? 'https://' : 'http://').$_SERVER['SERVER_NAME']; |
|
524 | 524 | if (!$https && $port != '80' || $https && $port != '443') |
525 | - $baseUrl .= ':' . $port; |
|
526 | - $this->baseUrl = $baseUrl . $base; |
|
525 | + $baseUrl .= ':'.$port; |
|
526 | + $this->baseUrl = $baseUrl.$base; |
|
527 | 527 | } elseif (!empty($base) && false === strpos($this->baseUrl, $base)) { |
528 | 528 | $this->baseUrl .= $base; |
529 | 529 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | */ |
560 | 560 | protected function getRequestFormat() |
561 | 561 | { |
562 | - $format = null ; |
|
562 | + $format = null; |
|
563 | 563 | // check if client has sent any information on request format |
564 | 564 | if ( |
565 | 565 | !empty($_SERVER['CONTENT_TYPE']) || |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | ); |
592 | 592 | } |
593 | 593 | } |
594 | - if(!$format){ |
|
594 | + if (!$format) { |
|
595 | 595 | $format = Scope::get($this->formatMap['default']); |
596 | 596 | } |
597 | 597 | return $format; |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | } |
631 | 631 | |
632 | 632 | $stream = $this->getRequestStream(); |
633 | - if($stream === FALSE) |
|
633 | + if ($stream === FALSE) |
|
634 | 634 | return array(); |
635 | 635 | $r = $this->requestFormat instanceof iDecodeStream |
636 | 636 | ? $this->requestFormat->decodeStream($stream) |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | if (!isset($o->className)) |
677 | 677 | throw new RestException(404); |
678 | 678 | |
679 | - if(isset($this->apiVersionMap[$o->className])){ |
|
679 | + if (isset($this->apiVersionMap[$o->className])) { |
|
680 | 680 | Scope::$classAliases[Util::getShortName($o->className)] |
681 | 681 | = $this->apiVersionMap[$o->className][$this->requestedApiVersion]; |
682 | 682 | } |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | header('Access-Control-Allow-Headers: ' |
724 | 724 | . $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']); |
725 | 725 | |
726 | - header('Access-Control-Allow-Origin: ' . |
|
726 | + header('Access-Control-Allow-Origin: '. |
|
727 | 727 | ((Defaults::$accessControlAllowOrigin == '*' && isset($_SERVER['HTTP_ORIGIN'])) |
728 | 728 | ? $_SERVER['HTTP_ORIGIN'] : Defaults::$accessControlAllowOrigin)); |
729 | 729 | header('Access-Control-Allow-Credentials: true'); |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | //check if the api method insists on response format using @format comment |
753 | 753 | |
754 | 754 | if ($metadata && isset($metadata['format'])) { |
755 | - $formats = explode(',', (string)$metadata['format']); |
|
755 | + $formats = explode(',', (string) $metadata['format']); |
|
756 | 756 | foreach ($formats as $i => $f) { |
757 | 757 | $f = trim($f); |
758 | 758 | if (!in_array($f, $this->formatOverridesMap)) |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | if (is_string(Defaults::$apiVendor) |
801 | 801 | && 0 === stripos($mime, |
802 | 802 | 'application/vnd.' |
803 | - . Defaults::$apiVendor . '-v') |
|
803 | + . Defaults::$apiVendor.'-v') |
|
804 | 804 | ) { |
805 | 805 | $extension = substr($accept, $index + 1); |
806 | 806 | if (isset($this->formatMap[$extension])) { |
@@ -846,8 +846,8 @@ discard block |
||
846 | 846 | $this->responseFormat = $format; |
847 | 847 | throw new RestException( |
848 | 848 | 406, |
849 | - 'Content negotiation failed. ' . |
|
850 | - 'Try `' . $format->getMIME() . '` instead.' |
|
849 | + 'Content negotiation failed. '. |
|
850 | + 'Try `'.$format->getMIME().'` instead.' |
|
851 | 851 | ); |
852 | 852 | } else { |
853 | 853 | // Tell cache content is based at Accept header |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | } else { |
875 | 875 | throw new RestException( |
876 | 876 | 406, |
877 | - 'Content negotiation failed. ' . |
|
877 | + 'Content negotiation failed. '. |
|
878 | 878 | 'Requested charset is not supported' |
879 | 879 | ); |
880 | 880 | } |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | $filterObj = Scope::get($filterClass); |
923 | 923 | |
924 | 924 | if (!$filterObj instanceof iFilter) { |
925 | - throw new RestException ( |
|
926 | - 500, 'Filter Class ' . |
|
925 | + throw new RestException( |
|
926 | + 500, 'Filter Class '. |
|
927 | 927 | 'should implement iFilter'); |
928 | 928 | } else if (!($ok = $filterObj->__isAllowed())) { |
929 | 929 | if (is_null($ok) |
@@ -955,8 +955,8 @@ discard block |
||
955 | 955 | try { |
956 | 956 | $authObj = Scope::get($authClass); |
957 | 957 | if (!method_exists($authObj, Defaults::$authenticationMethod)) { |
958 | - throw new RestException ( |
|
959 | - 500, 'Authentication Class ' . |
|
958 | + throw new RestException( |
|
959 | + 500, 'Authentication Class '. |
|
960 | 960 | 'should implement iAuthenticate'); |
961 | 961 | } elseif ( |
962 | 962 | !$authObj->{Defaults::$authenticationMethod}() |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | */ |
993 | 993 | protected function postAuthFilter() |
994 | 994 | { |
995 | - if(empty($this->postAuthFilterClasses)) { |
|
995 | + if (empty($this->postAuthFilterClasses)) { |
|
996 | 996 | return; |
997 | 997 | } |
998 | 998 | $this->dispatch('postAuthFilter'); |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | $o->accessLevel); |
1052 | 1052 | if (function_exists('newrelic_name_transaction')) |
1053 | 1053 | newrelic_name_transaction("{$o->className}/{$o->methodName}"); |
1054 | - $object = Scope::get($o->className); |
|
1054 | + $object = Scope::get($o->className); |
|
1055 | 1055 | switch ($accessLevel) { |
1056 | 1056 | case 3 : //protected method |
1057 | 1057 | $reflectionMethod = new \ReflectionMethod( |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | { |
1095 | 1095 | //only GET method should be cached if allowed by API developer |
1096 | 1096 | $expires = $this->requestMethod == 'GET' ? Defaults::$headerExpires : 0; |
1097 | - if(!is_array(Defaults::$headerCacheControl)) |
|
1097 | + if (!is_array(Defaults::$headerCacheControl)) |
|
1098 | 1098 | Defaults::$headerCacheControl = array(Defaults::$headerCacheControl); |
1099 | 1099 | $cacheControl = Defaults::$headerCacheControl[0]; |
1100 | 1100 | if ($expires > 0) { |
@@ -1104,14 +1104,14 @@ discard block |
||
1104 | 1104 | $cacheControl = str_replace('{expires}', $expires, $cacheControl); |
1105 | 1105 | $expires = gmdate('D, d M Y H:i:s \G\M\T', time() + $expires); |
1106 | 1106 | } |
1107 | - @header('Cache-Control: ' . $cacheControl); |
|
1108 | - @header('Expires: ' . $expires); |
|
1109 | - @header('X-Powered-By: Luracast Restler v' . Restler::VERSION); |
|
1107 | + @header('Cache-Control: '.$cacheControl); |
|
1108 | + @header('Expires: '.$expires); |
|
1109 | + @header('X-Powered-By: Luracast Restler v'.Restler::VERSION); |
|
1110 | 1110 | |
1111 | 1111 | if (Defaults::$crossOriginResourceSharing |
1112 | 1112 | && isset($_SERVER['HTTP_ORIGIN']) |
1113 | 1113 | ) { |
1114 | - header('Access-Control-Allow-Origin: ' . |
|
1114 | + header('Access-Control-Allow-Origin: '. |
|
1115 | 1115 | (Defaults::$accessControlAllowOrigin == '*' |
1116 | 1116 | ? $_SERVER['HTTP_ORIGIN'] |
1117 | 1117 | : Defaults::$accessControlAllowOrigin) |
@@ -1122,19 +1122,19 @@ discard block |
||
1122 | 1122 | |
1123 | 1123 | $this->responseFormat->setCharset(Defaults::$charset); |
1124 | 1124 | $charset = $this->responseFormat->getCharset() |
1125 | - ? : Defaults::$charset; |
|
1125 | + ?: Defaults::$charset; |
|
1126 | 1126 | |
1127 | - @header('Content-Type: ' . ( |
|
1127 | + @header('Content-Type: '.( |
|
1128 | 1128 | Defaults::$useVendorMIMEVersioning |
1129 | 1129 | ? 'application/vnd.' |
1130 | 1130 | . Defaults::$apiVendor |
1131 | 1131 | . "-v{$this->requestedApiVersion}" |
1132 | - . '+' . $this->responseFormat->getExtension() |
|
1132 | + . '+'.$this->responseFormat->getExtension() |
|
1133 | 1133 | : $this->responseFormat->getMIME()) |
1134 | - . '; charset=' . $charset |
|
1134 | + . '; charset='.$charset |
|
1135 | 1135 | ); |
1136 | 1136 | |
1137 | - @header('Content-Language: ' . Defaults::$language); |
|
1137 | + @header('Content-Language: '.Defaults::$language); |
|
1138 | 1138 | |
1139 | 1139 | if (isset($this->apiMethodInfo->metadata['header'])) { |
1140 | 1140 | foreach ($this->apiMethodInfo->metadata['header'] as $header) |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | } |
1153 | 1153 | $this->responseCode = $code; |
1154 | 1154 | @header( |
1155 | - "{$_SERVER['SERVER_PROTOCOL']} $code " . |
|
1155 | + "{$_SERVER['SERVER_PROTOCOL']} $code ". |
|
1156 | 1156 | (isset(RestException::$codes[$code]) ? RestException::$codes[$code] : '') |
1157 | 1157 | ); |
1158 | 1158 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | $authString = count($this->authClasses) |
1172 | 1172 | ? Scope::get($this->authClasses[0])->__getWWWAuthenticateString() |
1173 | 1173 | : 'Unknown'; |
1174 | - @header('WWW-Authenticate: ' . $authString, false); |
|
1174 | + @header('WWW-Authenticate: '.$authString, false); |
|
1175 | 1175 | } |
1176 | 1176 | $this->dispatch('complete'); |
1177 | 1177 | if (Defaults::$returnResponse) { |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | $this->exception = $exception; |
1199 | 1199 | |
1200 | - $method = 'handle' . $exception->getCode(); |
|
1200 | + $method = 'handle'.$exception->getCode(); |
|
1201 | 1201 | $handled = false; |
1202 | 1202 | foreach ($this->errorClasses as $className) { |
1203 | 1203 | if (method_exists($className, $method)) { |
@@ -1255,8 +1255,7 @@ discard block |
||
1255 | 1255 | public function setAPIVersion($version = 1, $minimum = 1) |
1256 | 1256 | { |
1257 | 1257 | if (!is_int($version) && $version < 1) { |
1258 | - throw new InvalidArgumentException |
|
1259 | - ('version should be an integer greater than 0'); |
|
1258 | + throw new InvalidArgumentException('version should be an integer greater than 0'); |
|
1260 | 1259 | } |
1261 | 1260 | $this->apiVersion = $version; |
1262 | 1261 | if (is_int($minimum)) { |
@@ -1311,7 +1310,7 @@ discard block |
||
1311 | 1310 | */ |
1312 | 1311 | public function addAPIClass($className, $resourcePath = null) |
1313 | 1312 | { |
1314 | - try{ |
|
1313 | + try { |
|
1315 | 1314 | if ($this->productionMode && is_null($this->cached)) { |
1316 | 1315 | $routes = $this->cache->get('routes'); |
1317 | 1316 | if (isset($routes) && is_array($routes)) { |
@@ -1341,12 +1340,12 @@ discard block |
||
1341 | 1340 | //versioned api |
1342 | 1341 | if (false !== ($index = strrpos($className, '\\'))) { |
1343 | 1342 | $name = substr($className, 0, $index) |
1344 | - . '\\v{$version}' . substr($className, $index); |
|
1343 | + . '\\v{$version}'.substr($className, $index); |
|
1345 | 1344 | } else if (false !== ($index = strrpos($className, '_'))) { |
1346 | 1345 | $name = substr($className, 0, $index) |
1347 | - . '_v{$version}' . substr($className, $index); |
|
1346 | + . '_v{$version}'.substr($className, $index); |
|
1348 | 1347 | } else { |
1349 | - $name = 'v{$version}\\' . $className; |
|
1348 | + $name = 'v{$version}\\'.$className; |
|
1350 | 1349 | } |
1351 | 1350 | |
1352 | 1351 | for ($version = $this->apiMinimumVersion; |
@@ -1478,13 +1477,13 @@ discard block |
||
1478 | 1477 | //versioned api |
1479 | 1478 | if (false !== ($index = strrpos($className, '\\'))) { |
1480 | 1479 | $name = substr($className, 0, $index) |
1481 | - . '\\v{$version}' . substr($className, $index); |
|
1480 | + . '\\v{$version}'.substr($className, $index); |
|
1482 | 1481 | } else { |
1483 | 1482 | if (false !== ($index = strrpos($className, '_'))) { |
1484 | 1483 | $name = substr($className, 0, $index) |
1485 | - . '_v{$version}' . substr($className, $index); |
|
1484 | + . '_v{$version}'.substr($className, $index); |
|
1486 | 1485 | } else { |
1487 | - $name = 'v{$version}\\' . $className; |
|
1486 | + $name = 'v{$version}\\'.$className; |
|
1488 | 1487 | } |
1489 | 1488 | } |
1490 | 1489 | |
@@ -1524,7 +1523,7 @@ discard block |
||
1524 | 1523 | } |
1525 | 1524 | } catch (Exception $e) { |
1526 | 1525 | $e = new Exception( |
1527 | - "mapAPIClasses failed. " . $e->getMessage(), |
|
1526 | + "mapAPIClasses failed. ".$e->getMessage(), |
|
1528 | 1527 | $e->getCode(), |
1529 | 1528 | $e |
1530 | 1529 | ); |
@@ -1653,7 +1652,7 @@ discard block |
||
1653 | 1652 | protected function preCall() |
1654 | 1653 | { |
1655 | 1654 | $o = & $this->apiMethodInfo; |
1656 | - $preCall = '_pre_' . $o->methodName . '_' |
|
1655 | + $preCall = '_pre_'.$o->methodName.'_' |
|
1657 | 1656 | . $this->requestFormat->getExtension(); |
1658 | 1657 | |
1659 | 1658 | if (method_exists($o->className, $preCall)) { |
@@ -1676,7 +1675,7 @@ discard block |
||
1676 | 1675 | protected function postCall() |
1677 | 1676 | { |
1678 | 1677 | $o = & $this->apiMethodInfo; |
1679 | - $postCall = '_post_' . $o->methodName . '_' . |
|
1678 | + $postCall = '_post_'.$o->methodName.'_'. |
|
1680 | 1679 | $this->responseFormat->getExtension(); |
1681 | 1680 | if (method_exists($o->className, $postCall)) { |
1682 | 1681 | $this->dispatch('postCall'); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | if (!function_exists('finfo_open')) { |
48 | 48 | throw new RestException( |
49 | 49 | 500, |
50 | - 'Unable to find media type of ' . |
|
51 | - basename($filename) . |
|
52 | - ' either enable fileinfo php extension or update ' . |
|
53 | - 'PassThrough::$mimeTypes to include mime type for ' . $extension . |
|
50 | + 'Unable to find media type of '. |
|
51 | + basename($filename). |
|
52 | + ' either enable fileinfo php extension or update '. |
|
53 | + 'PassThrough::$mimeTypes to include mime type for '.$extension. |
|
54 | 54 | ' extension' |
55 | 55 | ); |
56 | 56 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | $cacheControl = str_replace('{expires}', $expires, $cacheControl); |
67 | 67 | $expires = gmdate('D, d M Y H:i:s \G\M\T', time() + $expires); |
68 | 68 | } |
69 | - header('Cache-Control: ' . $cacheControl); |
|
70 | - header('Expires: ' . $expires); |
|
69 | + header('Cache-Control: '.$cacheControl); |
|
70 | + header('Expires: '.$expires); |
|
71 | 71 | $lastModified = filemtime($filename); |
72 | 72 | if ( |
73 | 73 | isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); |
77 | 77 | exit; |
78 | 78 | } |
79 | - header('Last-Modified: ' . date('r', $lastModified)); |
|
80 | - header('X-Powered-By: Luracast Restler v' . Restler::VERSION); |
|
81 | - header('Content-type: ' . $mime); |
|
82 | - header("Content-Length: " . filesize($filename)); |
|
79 | + header('Last-Modified: '.date('r', $lastModified)); |
|
80 | + header('X-Powered-By: Luracast Restler v'.Restler::VERSION); |
|
81 | + header('Content-type: '.$mime); |
|
82 | + header("Content-Length: ".filesize($filename)); |
|
83 | 83 | if ($forceDownload) { |
84 | 84 | header("Content-Transfer-Encoding: binary"); |
85 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
85 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
86 | 86 | } |
87 | 87 | readfile($filename); |
88 | 88 | exit; |
@@ -31,8 +31,8 @@ |
||
31 | 31 | public static function getUniqueIdentifier($includePlatform = false) |
32 | 32 | { |
33 | 33 | if (!static::$initialized) static::init(); |
34 | - return static::$id ? : base64_encode('ip:' . ($includePlatform |
|
35 | - ? static::$ip . '-' . static::$platform |
|
34 | + return static::$id ?: base64_encode('ip:'.($includePlatform |
|
35 | + ? static::$ip.'-'.static::$platform |
|
36 | 36 | : static::$ip |
37 | 37 | )); |
38 | 38 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | //changes in iAuthenticate |
29 | 29 | Defaults::$authenticationMethod = '__isAuthenticated'; |
30 | 30 | |
31 | -include __DIR__ . '/iAuthenticate.php'; |
|
31 | +include __DIR__.'/iAuthenticate.php'; |
|
32 | 32 | |
33 | 33 | //changes in auto routing |
34 | 34 | Defaults::$smartAutoRouting = false; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | //changes in iAuthenticate |
8 | 8 | Defaults::$authenticationMethod = 'isAuthenticated'; |
9 | -include __DIR__ . '/iAuthenticate.php'; |
|
9 | +include __DIR__.'/iAuthenticate.php'; |
|
10 | 10 | |
11 | 11 | //changes in routing |
12 | 12 | Defaults::$autoRoutingEnabled = false; |