Passed
Branch master (a40dae)
by Enrico
03:51
created
Category
examples/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 $app = new \uSILEX\Application;
6 6
 
7 7
 // create a service using pimple to be used as controller
8
-$app['say_hello_controller']= function ($app) {
8
+$app['say_hello_controller'] = function($app) {
9 9
     return $app->json(['hello', 'world']);
10 10
 };
11 11
 
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     const VERSION = '1.0.0';
21 21
     
22 22
     protected $providers = [];
23
-    protected $routes=[];
23
+    protected $routes = [];
24 24
     protected $booted = false;
25 25
 
26 26
     /**
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
         parent::__construct();
35 35
         $this['debug'] = false;
36 36
         $this['version'] = static::VERSION;
37
-        $this['error_msg.short_template']= 'Error %s (%s)';
38
-        $this['error_msg.full_template']= "Error %s (%s) - %s \nTrace info:\n%s\n";
39
-        $this['RouteMatcher'] = function ($c) {
37
+        $this['error_msg.short_template'] = 'Error %s (%s)';
38
+        $this['error_msg.full_template'] = "Error %s (%s) - %s \nTrace info:\n%s\n";
39
+        $this['RouteMatcher'] = function($c) {
40 40
             return new RouteMatcher($c);
41 41
         };
42
-        $this['ControllerResolver'] = function ($c) {
42
+        $this['ControllerResolver'] = function($c) {
43 43
             return new ControllerResolver($c);
44 44
         };
45 45
     }
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
      * @param \Exception $e a trapped exception
52 52
      *
53 53
      */
54
-    protected function exceptionToResponse( \Exception $e ): Response
54
+    protected function exceptionToResponse(\Exception $e): Response
55 55
     {
56
-        if ( $exception instanceof  HttpExceptionInterface ) {
57
-            $response =  new Response($e->getMessage(), $e->getStatusCode());            
56
+        if ($exception instanceof  HttpExceptionInterface) {
57
+            $response = new Response($e->getMessage(), $e->getStatusCode());            
58 58
         } else {
59 59
             $response = new Response(
60 60
                 $this['debug']
61
-                    ?sprintf( $this['error_msg.full_template'], $e->getCode(), $this['version'], $e->getMessage(), $e->getTraceAsString())
62
-                    :sprintf( $this['error_msg.short_template'], $e->getCode(), $this['version']),
61
+                    ?sprintf($this['error_msg.full_template'], $e->getCode(), $this['version'], $e->getMessage(), $e->getTraceAsString())
62
+                    :sprintf($this['error_msg.short_template'], $e->getCode(), $this['version']),
63 63
                 Response::HTTP_INTERNAL_SERVER_ERROR
64 64
             );
65 65
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
     
70 70
 
71
-    public function addRoute( Route $route ): Container
71
+    public function addRoute(Route $route): Container
72 72
     {
73 73
         $this->routes[] = $route;
74 74
         
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     
85 85
     public function handle(): Response 
86 86
     {
87
-        assert( isset($this['ControllerResolver']));
87
+        assert(isset($this['ControllerResolver']));
88 88
         
89 89
         try {
90 90
             if (!$this->booted) {
Please login to merge, or discard this patch.
src/RouteMatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 {
7 7
     protected $app;
8 8
     
9
-    public function __construct( Application $app) 
9
+    public function __construct(Application $app) 
10 10
     {    
11 11
         $this->app = $app;
12 12
     }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     
15 15
     public function match(Route $route) : bool 
16 16
     {
17
-        assert( isset($this->app['request']));
17
+        assert(isset($this->app['request']));
18 18
         
19 19
         return (
20 20
             ($route->getHttpVerb() == $this->app['request']->getMethod()) &&
Please login to merge, or discard this patch.
src/ControllerResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
     protected $app;
14 14
     
15 15
     
16
-    public function __construct( Application $app) 
16
+    public function __construct(Application $app) 
17 17
     {
18
-        assert( isset($app['RouteMatcher']));
18
+        assert(isset($app['RouteMatcher']));
19 19
         
20 20
         $this->app = $app;
21 21
     }
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function getController() : string
24 24
     {
25 25
         
26
-        foreach( $this->app->getRoutes() as $route) {
26
+        foreach ($this->app->getRoutes() as $route) {
27 27
             if ($this->app['RouteMatcher']->match($route)) {
28 28
                 return $route->getAction();
29 29
             }
Please login to merge, or discard this patch.
src/Route.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     protected $path;
9 9
     protected $action;
10 10
     
11
-    public function __construct( string $verb, string $path, string $action) 
11
+    public function __construct(string $verb, string $path, string $action) 
12 12
     {    
13 13
         $this->verb = strtoupper($verb);
14 14
         $this->path = $path;
Please login to merge, or discard this patch.