@@ -46,7 +46,7 @@ |
||
46 | 46 | $newName = $this->getFileName($key); |
47 | 47 | } |
48 | 48 | |
49 | - move_uploaded_file($this->getFileByKey($key, 'tmp_name'), $destinationPath . '/' . $newName); |
|
49 | + move_uploaded_file($this->getFileByKey($key, 'tmp_name'), $destinationPath.'/'.$newName); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function clearTemp($key) |
@@ -186,13 +186,13 @@ |
||
186 | 186 | $servername = $this->getServerName(); |
187 | 187 | |
188 | 188 | if ($port && $this->server('SERVER_PORT' !== false)) { |
189 | - $servername .= ':' . $this->server('SERVER_PORT'); |
|
189 | + $servername .= ':'.$this->server('SERVER_PORT'); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if ($protocol) { |
193 | 193 | $servername = ( |
194 | 194 | ($this->server('HTTPS') !== 'off' |
195 | - || $this->server('SERVER_PORT') == 443) ? "https://" : "http://") . $servername |
|
195 | + || $this->server('SERVER_PORT') == 443) ? "https://" : "http://").$servername |
|
196 | 196 | ; |
197 | 197 | } |
198 | 198 |
@@ -125,8 +125,9 @@ |
||
125 | 125 | |
126 | 126 | // loop data blocks |
127 | 127 | foreach ($blocks as $id => $block) { |
128 | - if (empty($block)) |
|
129 | - continue; |
|
128 | + if (empty($block)) { |
|
129 | + continue; |
|
130 | + } |
|
130 | 131 | |
131 | 132 | $name = []; |
132 | 133 | preg_match('/\bname=\"([^\"]*)\"\s*;/s', $block, $name); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @var Request |
12 | 12 | */ |
13 | - protected $psrRequest ; |
|
13 | + protected $psrRequest; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->server["REMOTE_ADDR"] = "127.0.0.1"; |
54 | 54 | $this->server["REMOTE_PORT"] = rand(1000, 60000); |
55 | 55 | $this->server["SERVER_SOFTWARE"] = "Mock"; |
56 | - $this->server["SERVER_PROTOCOL"] = "HTTP/" . $this->psrRequest->getProtocolVersion(); |
|
56 | + $this->server["SERVER_PROTOCOL"] = "HTTP/".$this->psrRequest->getProtocolVersion(); |
|
57 | 57 | $this->server["SERVER_NAME"] = $this->psrRequest->getUri()->getHost(); |
58 | 58 | $this->server["SERVER_PORT"] = $this->psrRequest->getUri()->getPort(); |
59 | 59 | $this->server["REQUEST_URI"] = $this->psrRequest->getRequestTarget(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // Headers and Cookies |
71 | 71 | $this->cookie = []; |
72 | 72 | foreach ($this->psrRequest->getHeaders() as $key => $value) { |
73 | - $this->server["HTTP_" . strtoupper($key)] = $this->psrRequest->getHeaderLine($key); |
|
73 | + $this->server["HTTP_".strtoupper($key)] = $this->psrRequest->getHeaderLine($key); |
|
74 | 74 | |
75 | 75 | if ($key == "Cookie") { |
76 | 76 | parse_str(preg_replace("/;\s*/", "&", $this->psrRequest->getHeaderLine($key)), $this->cookie); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'name' => $filename[1], |
158 | 158 | 'type' => (empty($contentType) ? "" : trim($contentType[1])), |
159 | 159 | 'size' => strlen($content), |
160 | - 'tmp_name' => sys_get_temp_dir() . "/" . $filename[1], |
|
160 | + 'tmp_name' => sys_get_temp_dir()."/".$filename[1], |
|
161 | 161 | 'error' => null |
162 | 162 | ]; |
163 | 163 | file_put_contents($strut["tmp_name"], $content); |
@@ -40,8 +40,8 @@ |
||
40 | 40 | public function getDetailedErrorHandler(); |
41 | 41 | |
42 | 42 | /** |
43 | - * @return Handler |
|
44 | - */ |
|
43 | + * @return Handler |
|
44 | + */ |
|
45 | 45 | public function getErrorHandler(); |
46 | 46 | |
47 | 47 | /** |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | $refClass = new \ReflectionClass($ex); |
20 | 20 | |
21 | - $title = str_replace("Exception", "", $refClass->getShortName()); |
|
21 | + $title = str_replace("Exception", "", $refClass->getShortName()); |
|
22 | 22 | $title = preg_replace("/([a-z0-9])([A-Z])/", "$1 $2", $title); |
23 | 23 | return preg_replace("/([a-z])(\d)/", "$1 $2", $title); |
24 | 24 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | public function getDispatcher() |
48 | 48 | { |
49 | 49 | // Generic Dispatcher for RestServer |
50 | - return simpleDispatcher(function (RouteCollector $r) { |
|
50 | + return simpleDispatcher(function(RouteCollector $r) { |
|
51 | 51 | |
52 | 52 | foreach ($this->getRoutes() as $route) { |
53 | 53 | $r->addRoute( |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | if (!is_object($object) && !is_array($object)) { |
29 | - $object = [ $object ]; |
|
29 | + $object = [$object]; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if ($this->serializationRule !== ResponseBag::SINGLE_OBJECT && $this->serializationRule !== ResponseBag::RAW) { |
@@ -83,7 +83,7 @@ |
||
83 | 83 | |
84 | 84 | foreach ($response->getHeaders() as $header => $value) { |
85 | 85 | if (is_array($value)) { |
86 | - $this->writer->header("$header: " . array_shift($value), true); |
|
86 | + $this->writer->header("$header: ".array_shift($value), true); |
|
87 | 87 | foreach ($value as $headerValue) { |
88 | 88 | $this->writer->header("$header: $headerValue", false); |
89 | 89 | } |
@@ -98,37 +98,37 @@ |
||
98 | 98 | |
99 | 99 | // Processing |
100 | 100 | switch ($routeInfo[0]) { |
101 | - case Dispatcher::NOT_FOUND: |
|
102 | - $outputProcessor->processResponse($this->getHttpResponse()); |
|
103 | - throw new Error404Exception("Route '$uri' not found"); |
|
101 | + case Dispatcher::NOT_FOUND: |
|
102 | + $outputProcessor->processResponse($this->getHttpResponse()); |
|
103 | + throw new Error404Exception("Route '$uri' not found"); |
|
104 | 104 | |
105 | - case Dispatcher::METHOD_NOT_ALLOWED: |
|
106 | - $outputProcessor->processResponse($this->getHttpResponse()); |
|
107 | - throw new Error405Exception('Method not allowed'); |
|
105 | + case Dispatcher::METHOD_NOT_ALLOWED: |
|
106 | + $outputProcessor->processResponse($this->getHttpResponse()); |
|
107 | + throw new Error405Exception('Method not allowed'); |
|
108 | 108 | |
109 | - case Dispatcher::FOUND: |
|
110 | - // ... 200 Process: |
|
111 | - $vars = array_merge($routeInfo[2], $queryStr); |
|
109 | + case Dispatcher::FOUND: |
|
110 | + // ... 200 Process: |
|
111 | + $vars = array_merge($routeInfo[2], $queryStr); |
|
112 | 112 | |
113 | - // Get the Selected Route |
|
114 | - $selectedRoute = $routeInfo[1]; |
|
113 | + // Get the Selected Route |
|
114 | + $selectedRoute = $routeInfo[1]; |
|
115 | 115 | |
116 | - // Class |
|
117 | - $class = $selectedRoute["class"]; |
|
118 | - $this->getHttpRequest()->appendVars($vars); |
|
116 | + // Class |
|
117 | + $class = $selectedRoute["class"]; |
|
118 | + $this->getHttpRequest()->appendVars($vars); |
|
119 | 119 | |
120 | - // Get OutputProcessor |
|
121 | - $outputProcessor = $this->initializeProcessor( |
|
122 | - $selectedRoute["output_processor"] |
|
123 | - ); |
|
120 | + // Get OutputProcessor |
|
121 | + $outputProcessor = $this->initializeProcessor( |
|
122 | + $selectedRoute["output_processor"] |
|
123 | + ); |
|
124 | 124 | |
125 | - // Execute the request |
|
126 | - $this->executeRequest($outputProcessor, $class); |
|
125 | + // Execute the request |
|
126 | + $this->executeRequest($outputProcessor, $class); |
|
127 | 127 | |
128 | - break; |
|
128 | + break; |
|
129 | 129 | |
130 | - default: |
|
131 | - throw new Error520Exception('Unknown'); |
|
130 | + default: |
|
131 | + throw new Error520Exception('Unknown'); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | // Process Class::Method() |
204 | 204 | $function = $class[1]; |
205 | - $class = $class[0]; |
|
205 | + $class = $class[0]; |
|
206 | 206 | if (!class_exists($class)) { |
207 | 207 | throw new ClassNotFoundException("Class '$class' defined in the route is not found"); |
208 | 208 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | throw new InvalidArgumentException("Default processor needs to class name of an OutputProcessor"); |
281 | 281 | } |
282 | 282 | if (!is_subclass_of($processor, BaseOutputProcessor::class)) { |
283 | - throw new InvalidArgumentException("Needs to be a class of " . BaseOutputProcessor::class); |
|
283 | + throw new InvalidArgumentException("Needs to be a class of ".BaseOutputProcessor::class); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 |