@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | ); |
31 | 31 | |
32 | 32 | if ($mimeProcResult->mime === '*/*') { |
33 | - $mimeProcResult->mime = 'application/vnd.' . $mimeProcResult->vendor . |
|
34 | - '+json; version=' . $mimeProcResult->apiVersion; |
|
33 | + $mimeProcResult->mime = 'application/vnd.'.$mimeProcResult->vendor. |
|
34 | + '+json; version='.$mimeProcResult->apiVersion; |
|
35 | 35 | $mimeProcResult->format = 'json'; |
36 | 36 | } |
37 | 37 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $response; |
50 | 50 | } |
51 | 51 | |
52 | - throw new Exception\NotAcceptable(0, [$mimeProcResult->mime . ' is not supported']); |
|
52 | + throw new Exception\NotAcceptable(0, [$mimeProcResult->mime.' is not supported']); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $vendor = $this->getContainer()->get(Application::CONTAINER_ID_VENDOR); |
61 | 61 | $apiVersion = $this->getContainer()->get(Application::CONTAINER_ID_API_VERSION); |
62 | 62 | |
63 | - $response->headers->set('Content-Type', 'application/vnd.' . $vendor . '-v' . $apiVersion . '+json'); |
|
63 | + $response->headers->set('Content-Type', 'application/vnd.'.$vendor.'-v'.$apiVersion.'+json'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $response->setStatusCode(method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500); |
@@ -28,6 +28,6 @@ |
||
28 | 28 | public function setApiVersion($version): void |
29 | 29 | { |
30 | 30 | $originalPath = $this->getPathInfo() === '' ? '/' : $this->getPathInfo(); |
31 | - $this->pathInfo = '/' . $version . $originalPath; |
|
31 | + $this->pathInfo = '/'.$version.$originalPath; |
|
32 | 32 | } |
33 | 33 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $routes = []; |
42 | 42 | $routingTable = $this->app->getRouter()->getRoutingTable(); |
43 | 43 | |
44 | - usort($routingTable, static function ($a, $b) { |
|
44 | + usort($routingTable, static function($a, $b) { |
|
45 | 45 | return ($a['route'] < $b['route']) ? -1 : 1; |
46 | 46 | }); |
47 | 47 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->container->add(self::CONTAINER_ID_VENDOR, $configuration->getVendor()); |
75 | 75 | $this->container->add(self::CONTAINER_ID_API_VERSION, $configuration->getApiVersion()); |
76 | 76 | $this->container->add(self::CONTAINER_ID_DEBUG, $configuration->isDebug()); |
77 | - $this->container->add(self::CONTAINER_ID_ROUTER, function () { |
|
77 | + $this->container->add(self::CONTAINER_ID_ROUTER, function() { |
|
78 | 78 | return $this->router; |
79 | 79 | }); |
80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $controller = new $class($this->container); |
103 | 103 | |
104 | - $this->container->add($class, static function () use ($controller) { |
|
104 | + $this->container->add($class, static function() use ($controller) { |
|
105 | 105 | return $controller; |
106 | 106 | }); |
107 | 107 | } |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | |
169 | 169 | return $response; |
170 | 170 | } catch (Exception $e) { |
171 | - if (!$catch) { |
|
171 | + if ( ! $catch) { |
|
172 | 172 | throw $e; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $response = call_user_func($this->exceptionDecorator, $e); |
176 | - if (!$response instanceof Response) { |
|
176 | + if ( ! $response instanceof Response) { |
|
177 | 177 | throw new LogicException( |
178 | 178 | 'Exception decorator did not return an instance of Symfony\Component\HttpFoundation\Response' |
179 | 179 | ); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $this->configuration->getErrorHandler()->pushHandler($this->configuration->getLogHandler()); |
347 | 347 | $this->configuration->getErrorHandler()->register(); |
348 | 348 | |
349 | - $this->setExceptionDecorator(static function (Exception $e) use ($app) { |
|
349 | + $this->setExceptionDecorator(static function(Exception $e) use ($app) { |
|
350 | 350 | $formatter = new ErrorHandler\Formatter\JsonXml($app->configuration); |
351 | 351 | |
352 | 352 | return new Response($formatter->format($e), http_response_code()); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function register(ContainerInterface $container, Configurable $config): void |
20 | 20 | { |
21 | - if (! $config instanceof Config) { |
|
21 | + if ( ! $config instanceof Config) { |
|
22 | 22 | throw new InvalidArgumentException('Wrong Config object'); |
23 | 23 | } |
24 | 24 |
@@ -81,13 +81,13 @@ |
||
81 | 81 | |
82 | 82 | protected function buildLogMessage(Exception $exception): string |
83 | 83 | { |
84 | - $message = $exception->getMessage() . "({$exception->getCode()})"; |
|
84 | + $message = $exception->getMessage()."({$exception->getCode()})"; |
|
85 | 85 | |
86 | 86 | if ($exception instanceof PhprestException && $exception->getDetails()) { |
87 | - $message .= ' Details :: ' . json_encode($exception->getDetails()); |
|
87 | + $message .= ' Details :: '.json_encode($exception->getDetails()); |
|
88 | 88 | } |
89 | 89 | |
90 | - $message .= ' Stack trace :: ' . $exception->getTraceAsString(); |
|
90 | + $message .= ' Stack trace :: '.$exception->getTraceAsString(); |
|
91 | 91 | |
92 | 92 | return $message; |
93 | 93 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $this->method = $options['method']; |
51 | 51 | $this->path = $options['path']; |
52 | - $this->version = null !== $version ? '{version:' . $version . '}' : '{version:any}'; |
|
52 | + $this->version = null !== $version ? '{version:'.$version.'}' : '{version:any}'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function validate(array $options): void |
61 | 61 | { |
62 | - if (! isset($options['method'])) { |
|
62 | + if ( ! isset($options['method'])) { |
|
63 | 63 | throw new InvalidArgumentException('method property is missing'); |
64 | - } elseif (! in_array($options['method'], ['GET', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE', 'HEAD'])) { |
|
64 | + } elseif ( ! in_array($options['method'], ['GET', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE', 'HEAD'])) { |
|
65 | 65 | throw new InvalidArgumentException('method property is not valid'); |
66 | - } elseif (! isset($options['path'])) { |
|
66 | + } elseif ( ! isset($options['path'])) { |
|
67 | 67 | throw new InvalidArgumentException('path property is missing'); |
68 | 68 | } elseif ( |
69 | 69 | isset($options['since']) |
70 | - && ! preg_match('#^' . Application::API_VERSION_REG_EXP . '$#', $options['since']) |
|
70 | + && ! preg_match('#^'.Application::API_VERSION_REG_EXP.'$#', $options['since']) |
|
71 | 71 | ) { |
72 | 72 | throw new InvalidArgumentException('since property is not valid'); |
73 | 73 | } elseif ( |
74 | 74 | isset($options['until']) |
75 | - && ! preg_match('#^' . Application::API_VERSION_REG_EXP . '$#', $options['until']) |
|
75 | + && ! preg_match('#^'.Application::API_VERSION_REG_EXP.'$#', $options['until']) |
|
76 | 76 | ) { |
77 | 77 | throw new InvalidArgumentException('until property is not valid'); |
78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $sinceVersion = str_pad($sinceVersion, 3, '.0'); |
90 | 90 | $untilVersion = str_pad($untilVersion, 3, '.0'); |
91 | 91 | |
92 | - if (! ($sinceVersion < $untilVersion)) { |
|
92 | + if ( ! ($sinceVersion < $untilVersion)) { |
|
93 | 93 | throw new LogicException('since must be lesser than until'); |
94 | 94 | } |
95 | 95 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct(\Exception $exception) |
33 | 33 | { |
34 | - $this->code = (int) $exception->getCode(); |
|
34 | + $this->code = (int)$exception->getCode(); |
|
35 | 35 | $this->message = $exception->getMessage(); |
36 | 36 | |
37 | 37 | if ($exception instanceof Exception) { |