@@ -53,38 +53,38 @@  | 
                                                    ||
| 53 | 53 | |
| 54 | 54 | // Processing  | 
                                                        
| 55 | 55 |          switch ($routeInfo[0]) { | 
                                                        
| 56 | - case Dispatcher::NOT_FOUND:  | 
                                                        |
| 57 | -                if ($this->tryDeliveryPhysicalFile() === false) { | 
                                                        |
| 58 | - $this->prepareToOutput();  | 
                                                        |
| 59 | -                    throw new Error404Exception("Route '$uri' not found"); | 
                                                        |
| 60 | - }  | 
                                                        |
| 61 | - return true;  | 
                                                        |
| 62 | -  | 
                                                        |
| 63 | - case Dispatcher::METHOD_NOT_ALLOWED:  | 
                                                        |
| 56 | + case Dispatcher::NOT_FOUND:  | 
                                                        |
| 57 | +            if ($this->tryDeliveryPhysicalFile() === false) { | 
                                                        |
| 64 | 58 | $this->prepareToOutput();  | 
                                                        
| 65 | -                throw new Error405Exception('Method not allowed'); | 
                                                        |
| 59 | +                throw new Error404Exception("Route '$uri' not found"); | 
                                                        |
| 60 | + }  | 
                                                        |
| 61 | + return true;  | 
                                                        |
| 62 | +  | 
                                                        |
| 63 | + case Dispatcher::METHOD_NOT_ALLOWED:  | 
                                                        |
| 64 | + $this->prepareToOutput();  | 
                                                        |
| 65 | +            throw new Error405Exception('Method not allowed'); | 
                                                        |
| 66 | 66 | |
| 67 | - case Dispatcher::FOUND:  | 
                                                        |
| 68 | - // ... 200 Process:  | 
                                                        |
| 69 | - $vars = array_merge($routeInfo[2], $queryStr);  | 
                                                        |
| 67 | + case Dispatcher::FOUND:  | 
                                                        |
| 68 | + // ... 200 Process:  | 
                                                        |
| 69 | + $vars = array_merge($routeInfo[2], $queryStr);  | 
                                                        |
| 70 | 70 | |
| 71 | - // Get the Selected Route  | 
                                                        |
| 72 | - $selectedRoute = $routeInfo[1];  | 
                                                        |
| 71 | + // Get the Selected Route  | 
                                                        |
| 72 | + $selectedRoute = $routeInfo[1];  | 
                                                        |
| 73 | 73 | |
| 74 | - // Default Handler for errors and  | 
                                                        |
| 75 | - $outputProcessor = $this->prepareToOutput($selectedRoute["output_processor"]);  | 
                                                        |
| 74 | + // Default Handler for errors and  | 
                                                        |
| 75 | + $outputProcessor = $this->prepareToOutput($selectedRoute["output_processor"]);  | 
                                                        |
| 76 | 76 | |
| 77 | - // Class  | 
                                                        |
| 78 | - $class = $selectedRoute["class"];  | 
                                                        |
| 79 | - $request->appendVars($vars);  | 
                                                        |
| 77 | + // Class  | 
                                                        |
| 78 | + $class = $selectedRoute["class"];  | 
                                                        |
| 79 | + $request->appendVars($vars);  | 
                                                        |
| 80 | 80 | |
| 81 | - // Execute the request  | 
                                                        |
| 82 | - $this->executeRequest($outputProcessor, $class, $request);  | 
                                                        |
| 81 | + // Execute the request  | 
                                                        |
| 82 | + $this->executeRequest($outputProcessor, $class, $request);  | 
                                                        |
| 83 | 83 | |
| 84 | - break;  | 
                                                        |
| 84 | + break;  | 
                                                        |
| 85 | 85 | |
| 86 | - default:  | 
                                                        |
| 87 | -                throw new Error520Exception('Unknown'); | 
                                                        |
| 86 | + default:  | 
                                                        |
| 87 | +            throw new Error520Exception('Unknown'); | 
                                                        |
| 88 | 88 | }  | 
                                                        
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
@@ -127,7 +127,7 @@  | 
                                                    ||
| 127 | 127 | |
| 128 | 128 | // Process Class::Method()  | 
                                                        
| 129 | 129 | $function = $class[1];  | 
                                                        
| 130 | - $class = $class[0];  | 
                                                        |
| 130 | + $class = $class[0];  | 
                                                        |
| 131 | 131 |          if (!class_exists($class)) { | 
                                                        
| 132 | 132 |              throw new ClassNotFoundException("Class '$class' defined in the route is not found"); | 
                                                        
| 133 | 133 | }  | 
                                                        
@@ -96,7 +96,7 @@  | 
                                                    ||
| 96 | 96 | new RoutePattern(  | 
                                                        
| 97 | 97 | $route->getMethod(),  | 
                                                        
| 98 | 98 | $route->getPattern(),  | 
                                                        
| 99 | -                    function () use ($route) { | 
                                                        |
| 99 | +                    function() use ($route) { | 
                                                        |
| 100 | 100 | return new MockOutputProcessor($route->getOutputProcessor());  | 
                                                        
| 101 | 101 | },  | 
                                                        
| 102 | 102 | $class,  | 
                                                        
@@ -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(  | 
                                                        
@@ -117,7 +117,7 @@ discard block  | 
                                                    ||
| 117 | 117 | );  | 
                                                        
| 118 | 118 | }  | 
                                                        
| 119 | 119 | |
| 120 | - $outputProcessor = $this->getMethodOutputProcessor($method, $basePath. $path, $properties);  | 
                                                        |
| 120 | + $outputProcessor = $this->getMethodOutputProcessor($method, $basePath . $path, $properties);  | 
                                                        |
| 121 | 121 | |
| 122 | 122 | $routes[] = new RoutePattern(  | 
                                                        
| 123 | 123 | strtoupper($method),  | 
                                                        
@@ -134,7 +134,7 @@ discard block  | 
                                                    ||
| 134 | 134 | |
| 135 | 135 | protected function sortPaths($pathList)  | 
                                                        
| 136 | 136 |      { | 
                                                        
| 137 | -        usort($pathList, function ($left, $right) { | 
                                                        |
| 137 | +        usort($pathList, function($left, $right) { | 
                                                        |
| 138 | 138 |              if (strpos($left, '{') === false && strpos($right, '{') !== false) { | 
                                                        
| 139 | 139 | return -16384;  | 
                                                        
| 140 | 140 | }  | 
                                                        
@@ -169,7 +169,7 @@ discard block  | 
                                                    ||
| 169 | 169 | |
| 170 | 170 | $produces = null;  | 
                                                        
| 171 | 171 |          if (isset($properties['produces'])) { | 
                                                        
| 172 | - $produces = (array) $properties['produces'];  | 
                                                        |
| 172 | + $produces = (array)$properties['produces'];  | 
                                                        |
| 173 | 173 | }  | 
                                                        
| 174 | 174 |          if (empty($produces) && isset($properties["responses"]["200"]["content"])) { | 
                                                        
| 175 | 175 | $produces = array_keys($properties["responses"]["200"]["content"]);  | 
                                                        
@@ -10,7 +10,7 @@  | 
                                                    ||
| 10 | 10 | /**  | 
                                                        
| 11 | 11 | * @var Request  | 
                                                        
| 12 | 12 | */  | 
                                                        
| 13 | - protected $psrRequest ;  | 
                                                        |
| 13 | + protected $psrRequest;  | 
                                                        |
| 14 | 14 | |
| 15 | 15 | /**  | 
                                                        
| 16 | 16 | *  | 
                                                        
@@ -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); |