Completed
Push — master ( a40dae...3ec68e )
by Enrico
03:25 queued 28s
created
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 = $verb;
14 14
         $this->path = $path;
Please login to merge, or discard this patch.
src/RouteMatcher.php 1 patch
Spacing   +5 added lines, -5 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,17 +14,17 @@  discard block
 block discarded – undo
14 14
     
15 15
     public function match(Route $route) : array 
16 16
     {
17
-        assert( isset($this->app['request']));
17
+        assert(isset($this->app['request']));
18 18
         
19
-        $verbRegexp= '#^' . $route->getHttpVerb() . '$#i'; // case insensitive
20
-        $pathRegexp= '#^' . $route->getPath() . '$#'; // case sensitive
19
+        $verbRegexp = '#^'.$route->getHttpVerb().'$#i'; // case insensitive
20
+        $pathRegexp = '#^'.$route->getPath().'$#'; // case sensitive
21 21
         
22 22
         
23 23
         // ignore regexp errors...
24 24
         $matches = null;
25 25
         try {
26 26
             preg_match($verbRegexp, $this->app['request']->getMethod()) &&
27
-            preg_match($pathRegexp, $this->app['request']->getPathInfo(),$matches);
27
+            preg_match($pathRegexp, $this->app['request']->getPathInfo(), $matches);
28 28
         } catch (Exception $e) {}
29 29
         
30 30
         return $matches;
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +16 added lines, -16 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,8 +84,8 @@  discard block
 block discarded – undo
84 84
     
85 85
     public function handleRequest(): Response 
86 86
     {
87
-        assert( isset($this['ControllerResolver']));
88
-        assert( isset($this['request']));
87
+        assert(isset($this['ControllerResolver']));
88
+        assert(isset($this['request']));
89 89
         
90 90
         try {
91 91
             if (!$this->booted) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             assert(isset($this[$controllerService]));
100 100
             
101 101
             // call on_route_match hook
102
-            if( isset($this['on_route_match'])) {
102
+            if (isset($this['on_route_match'])) {
103 103
                 $this['on_route_match.result'] = $this['on_route_match'];
104 104
             }
105 105
             
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
         }
202 202
         
203 203
         // call on_response hook
204
-        if( isset($this['on_response'])) {
204
+        if (isset($this['on_response'])) {
205 205
             $this['response'] = $this['on_response'];
206 206
         }
207 207
         
208 208
         // define $this['uSILEX_IGNORE_SEND'] just for unit testing purposes
209
-        if( !( isset($this['uSILEX_IGNORE_SEND']) &&  $this['uSILEX_IGNORE_SEND'])) {
209
+        if (!(isset($this['uSILEX_IGNORE_SEND']) && $this['uSILEX_IGNORE_SEND'])) {
210 210
             $this['response']->send();
211 211
         } 
212 212
         
Please login to merge, or discard this patch.
src/ControllerResolver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@
 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
     }
22 22
 
23 23
     public function getController() : string
24 24
     {
25
-        assert( isset($this->app['request']));
25
+        assert(isset($this->app['request']));
26 26
         
27
-        foreach( $this->app->getRoutes() as $route) {
27
+        foreach ($this->app->getRoutes() as $route) {
28 28
             if ($matches = $this->app['RouteMatcher']->match($route)) {
29 29
                 $this->app['request.matches'] = $matches;
30 30
                 $this->app['request.route'] = $route;
Please login to merge, or discard this patch.