@@ -20,8 +20,8 @@ |
||
20 | 20 | |
21 | 21 | protected function writeHeader(HttpResponse $response) |
22 | 22 | { |
23 | - echo "HTTP/1.1 " . $response->getResponseCode() . "\r\n"; |
|
24 | - echo "Content-Type: " . $this->getContentType() . "\r\n"; |
|
23 | + echo "HTTP/1.1 ".$response->getResponseCode()."\r\n"; |
|
24 | + echo "Content-Type: ".$this->getContentType()."\r\n"; |
|
25 | 25 | |
26 | 26 | foreach ($response->getHeaders() as $header => $value) { |
27 | 27 | if (is_array($value)) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (defined("RESTSERVER_TEST")) { |
63 | 63 | return; |
64 | 64 | } |
65 | - header("Content-Type: " . $this->contentType); |
|
65 | + header("Content-Type: ".$this->contentType); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public function getContentType() |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | foreach ($response->getHeaders() as $header => $value) { |
76 | 76 | if (is_array($value)) { |
77 | - header("$header: " . array_shift($value), true); |
|
77 | + header("$header: ".array_shift($value), true); |
|
78 | 78 | foreach ($value as $headerValue) { |
79 | 79 | header("$header: $headerValue", false); |
80 | 80 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | protected $useErrorHandler = true; |
24 | 24 | protected $detailedErrorHandler = false; |
25 | 25 | protected $corsOrigins = []; |
26 | - protected $corsMethods = [ 'GET', 'POST', 'PUT', 'DELETE', 'PATCH']; |
|
26 | + protected $corsMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH']; |
|
27 | 27 | protected $corsHeaders = [ |
28 | 28 | 'Authorization', |
29 | 29 | 'Content-Type', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | case Dispatcher::METHOD_NOT_ALLOWED: |
85 | 85 | $outputProcessor = $this->prepareToOutput(); |
86 | 86 | if (strtoupper($httpMethod) == "OPTIONS" && !empty($this->corsOrigins)) { |
87 | - $this->executeRequest($outputProcessor, function () {}, $request); |
|
87 | + $this->executeRequest($outputProcessor, function() {}, $request); |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | throw new Error405Exception('Method not allowed'); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | if (preg_match("~^.*//$origin$~", $request->server('HTTP_ORIGIN'))) { |
157 | 157 | $response->addHeader("Access-Control-Allow-Origin", $request->server('HTTP_ORIGIN')); |
158 | 158 | $response->addHeader('Access-Control-Allow-Credentials', 'true'); |
159 | - $response->addHeader('Access-Control-Max-Age', '86400'); // cache for 1 day |
|
159 | + $response->addHeader('Access-Control-Max-Age', '86400'); // cache for 1 day |
|
160 | 160 | |
161 | 161 | // Access-Control headers are received during OPTIONS requests |
162 | 162 | if ($request->server('REQUEST_METHOD') == 'OPTIONS') { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | // Process Class::Method() |
182 | 182 | $function = $class[1]; |
183 | - $class = $class[0]; |
|
183 | + $class = $class[0]; |
|
184 | 184 | if (!class_exists($class)) { |
185 | 185 | throw new ClassNotFoundException("Class '$class' defined in the route is not found"); |
186 | 186 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | throw new InvalidArgumentException("Default processor needs to class name of an OutputProcessor"); |
366 | 366 | } |
367 | 367 | if (!is_subclass_of($processor, BaseOutputProcessor::class)) { |
368 | - throw new InvalidArgumentException("Needs to be a class of " . BaseOutputProcessor::class); |
|
368 | + throw new InvalidArgumentException("Needs to be a class of ".BaseOutputProcessor::class); |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 |