Passed
Branch master (506a77)
by Henri
02:00 queued 52s
created
src/Helper.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     }
39 39
 
40 40
     protected function ControllerForm($controller, string $method, array $values){
41
-		$this->check_role();
41
+        $this->check_role();
42 42
 
43 43
         $role = ($method !== 'method') ? $method : $this->getData()['POST']['role'];
44 44
         $data = (!is_null($values)) ? json_decode($values['data']) : null;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace HnrAzevedo\Router;
4 4
 
5
-trait Helper{
5
+trait Helper {
6 6
     use CheckTrait, ControllerTrait;
7 7
     
8 8
     protected function getProtocol(): string
9 9
     {
10
-        if((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')){
10
+        if ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) {
11 11
             return 'ajax';
12 12
         }
13 13
         
14 14
         /* ONLY FOR DEBUG CONDITION */
15
-        if(!array_key_exists('REQUEST_METHOD',$_SERVER)){
15
+        if (!array_key_exists('REQUEST_METHOD', $_SERVER)) {
16 16
             return 'get';
17 17
         }
18 18
 
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
     protected function import(string $path)
32 32
     {
33 33
         foreach (scandir($path) as $routeFile) {
34
-            if(pathinfo($path.DIRECTORY_SEPARATOR.$routeFile, PATHINFO_EXTENSION) === 'php'){
35
-                require_once($path. DIRECTORY_SEPARATOR .$routeFile);
34
+            if (pathinfo($path.DIRECTORY_SEPARATOR.$routeFile, PATHINFO_EXTENSION) === 'php') {
35
+                require_once($path.DIRECTORY_SEPARATOR.$routeFile);
36 36
             }
37 37
         }
38 38
     }
39 39
 
40
-    protected function ControllerForm($controller, string $method, array $values){
40
+    protected function ControllerForm($controller, string $method, array $values) {
41 41
 		$this->check_role();
42 42
 
43 43
         $role = ($method !== 'method') ? $method : $this->getData()['POST']['role'];
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $data = $this->getData();
51 51
 
52 52
         foreach ($data['GET'] as $name => $value) {
53
-            $controll = str_replace('{'.$name.'}',$value,$controll);
53
+            $controll = str_replace('{'.$name.'}', $value, $controll);
54 54
         }
55 55
 
56 56
         $this->check_controllsettable($controll);
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 
60 60
         $this->check_controllmethod($controll);
61 61
 
62
-        $controller = 'Controllers\\' . ucfirst(explode(':',$controll)[0]);
62
+        $controller = 'Controllers\\'.ucfirst(explode(':', $controll)[0]);
63 63
         $controller = new $controller();
64
-        $method = explode(':',$controll)[1];
64
+        $method = explode(':', $controll)[1];
65 65
 
66
-        if( ( $this->getProtocol() == 'form') ){
66
+        if (($this->getProtocol() == 'form')) {
67 67
             $this->ControllerForm($controller, $method, $data['POST']);
68 68
         }else {
69 69
             $controller->$method($data);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
     protected function explodeRoute(bool $bar, string $url): array
74 74
     {   
75
-        return explode( '/', $bar ? substr($url, 0, -1) : $url );
75
+        return explode('/', $bar ? substr($url, 0, -1) : $url);
76 76
     }
77 77
 
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.