Passed
Pull Request — master (#42)
by
unknown
02:12
created
exemple/spoofing/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * GET httpMethod
12 12
  */
13
-$router->get("/", function ($data) {
13
+$router->get("/", function($data) {
14 14
     $data = ["realHttp" => $_SERVER["REQUEST_METHOD"]] + $data;
15 15
     echo "<h1>GET :: Spoofing</h1>", "<pre>", print_r($data, true), "</pre>";
16 16
 });
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * POST httpMethod
20 20
  */
21
-$router->post("/", function ($data) {
21
+$router->post("/", function($data) {
22 22
     $data = ["realHttp" => $_SERVER["REQUEST_METHOD"]] + $data;
23 23
     echo "<h1>POST :: Spoofing</h1>", "<pre>", print_r($data, true), "</pre>";
24 24
 });
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 /**
27 27
  * PUT spoofing and httpMethod
28 28
  */
29
-$router->put("/", function ($data) {
29
+$router->put("/", function($data) {
30 30
     $data = ["realHttp" => $_SERVER["REQUEST_METHOD"]] + $data;
31 31
     echo "<h1>PUT :: Spoofing</h1>", "<pre>", print_r($data, true), "</pre>";
32 32
 });
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 /**
35 35
  * PATCH spoofing and httpMethod
36 36
  */
37
-$router->patch("/", function ($data) {
37
+$router->patch("/", function($data) {
38 38
     $data = ["realHttp" => $_SERVER["REQUEST_METHOD"]] + $data;
39 39
     echo "<h1>PATCH :: Spoofing</h1>", "<pre>", print_r($data, true), "</pre>";
40 40
 });
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 /**
43 43
  * DELETE spoofing and httpMethod
44 44
  */
45
-$router->delete("/", function ($data) {
45
+$router->delete("/", function($data) {
46 46
     $data = ["realHttp" => $_SERVER["REQUEST_METHOD"]] + $data;
47 47
     echo "<h1>DELETE :: Spoofing</h1>", "<pre>", print_r($data, true), "</pre>";
48 48
 });
Please login to merge, or discard this patch.
src/RouterTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
         $route = (!$this->group ? $route : "/{$this->group}{$route}");
75 75
         $data = $this->data;
76 76
         $namespace = $this->namespace;
77
-        $router = function () use ($method, $handler, $data, $route, $name, $namespace) {
77
+        $router = function() use ($method, $handler, $data, $route, $name, $namespace) {
78 78
             return [
79 79
                 "route" => $route,
80 80
                 "name" => $name,
Please login to merge, or discard this patch.
src/Dispatch.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
      * @param null|string $namespace
72 72
      * @return Dispatch
73 73
      */
74
-    public function namespace(?string $namespace): Dispatch
74
+    public function namespace(?string $namespace) : Dispatch
75 75
     {
76 76
         $this->namespace = ($namespace ? ucwords($namespace) : null);
77 77
         return $this;
Please login to merge, or discard this patch.
src/Router.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,19 +80,19 @@
 block discarded – undo
80 80
      */
81 81
     public function resource(string $resource_name, $handler, string $name = null, string $model_id_name = null): void
82 82
     {
83
-        $resource_name = substr($resource_name, 0, 1) == '/' ? $resource_name : "/".$resource_name;
83
+        $resource_name = substr($resource_name, 0, 1) == '/' ? $resource_name : "/" . $resource_name;
84 84
         $sanitRoute = substr_replace($resource_name, '', 0, 1);
85 85
         $sanitRoute = (explode('/', $sanitRoute))[0];
86
-        $model_id_name = $model_id_name ?? singularize($sanitRoute)."_id";
86
+        $model_id_name = $model_id_name ?? singularize($sanitRoute) . "_id";
87 87
 
88
-        $this->addRoute("GET", $resource_name, $handler.":list", ($name ? "{$name}.list" : null));
89
-        $this->addRoute("GET", "{$resource_name}/home", $handler.":list", ($name ? "{$name}.home" : null));
90
-        $this->addRoute("GET", "{$resource_name}/home/{search}/{page}", $handler.":list", ($name ? "{$name}.searchGet" : null));
91
-        $this->addRoute("GET", singularize($resource_name), $handler.":create", ($name ? "{$name}.create" : null));
92
-        $this->addRoute("GET", singularize($resource_name)."/{{$model_id_name}}", $handler.":edit", ($name ? "{$name}.edit" : null));
93
-        $this->addRoute("POST", "{$resource_name}/search", $handler.":search", ($name ? "{$name}.searchPost" : null));
94
-        $this->addRoute("POST", singularize($resource_name), $handler.":store", ($name ? "{$name}.store" : null));
95
-        $this->addRoute("POST", singularize($resource_name)."/{{$model_id_name}}", $handler.":update", ($name ? "{$name}.update" : null));
96
-        $this->addRoute("DELETE", singularize($resource_name)."/{{$model_id_name}}", $handler.":delete", ($name ? "{$name}.delete" : null));
88
+        $this->addRoute("GET", $resource_name, $handler . ":list", ($name ? "{$name}.list" : null));
89
+        $this->addRoute("GET", "{$resource_name}/home", $handler . ":list", ($name ? "{$name}.home" : null));
90
+        $this->addRoute("GET", "{$resource_name}/home/{search}/{page}", $handler . ":list", ($name ? "{$name}.searchGet" : null));
91
+        $this->addRoute("GET", singularize($resource_name), $handler . ":create", ($name ? "{$name}.create" : null));
92
+        $this->addRoute("GET", singularize($resource_name) . "/{{$model_id_name}}", $handler . ":edit", ($name ? "{$name}.edit" : null));
93
+        $this->addRoute("POST", "{$resource_name}/search", $handler . ":search", ($name ? "{$name}.searchPost" : null));
94
+        $this->addRoute("POST", singularize($resource_name), $handler . ":store", ($name ? "{$name}.store" : null));
95
+        $this->addRoute("POST", singularize($resource_name) . "/{{$model_id_name}}", $handler . ":update", ($name ? "{$name}.update" : null));
96
+        $this->addRoute("DELETE", singularize($resource_name) . "/{{$model_id_name}}", $handler . ":delete", ($name ? "{$name}.delete" : null));
97 97
     }
98 98
 }
99 99
\ No newline at end of file
Please login to merge, or discard this patch.