Passed
Push — master ( 4c0eed...75e36f )
by Henri
02:06 queued 49s
created
src/CheckTrait.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Exception;
6 6
 
7
-trait CheckTrait{
7
+trait CheckTrait {
8 8
     use FilterTrait;
9 9
 
10 10
     protected function check_protocol(string $expected, string $current): bool
@@ -12,21 +12,21 @@  discard block
 block discarded – undo
12 12
         return ($expected === $current);
13 13
     }
14 14
 
15
-    protected function check_name(string $route_name){
16
-        if(!array_key_exists($route_name,$this->routers)){
17
-            throw new Exception('Page not found.',404);
15
+    protected function check_name(string $route_name) {
16
+        if (!array_key_exists($route_name, $this->routers)) {
17
+            throw new Exception('Page not found.', 404);
18 18
         }
19 19
     }
20 20
 
21
-    protected function check_typeRole($role){
22
-        if(!is_string($role) && @get_class($role) !== 'Closure' ){
21
+    protected function check_typeRole($role) {
22
+        if (!is_string($role) && @get_class($role) !== 'Closure') {
23 23
             throw new Exception("Improperly defined route track.");
24 24
         }
25 25
     }
26 26
 
27 27
     protected function check_config()
28 28
     {
29
-        if(!defined('ROUTER_CONFIG')){
29
+        if (!defined('ROUTER_CONFIG')) {
30 30
             throw new Exception("Information for loading routes has not been defined.");
31 31
         }
32 32
     }
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 
39 39
     protected function check_parameters(array $route_loop, array $route_request): bool
40 40
     {
41
-        foreach($route_loop as $rr => $param){
42
-            if( (substr($param,0,1) === '{') ){
43
-                $_GET[ substr($param,1,strlen($param)-2) ] = $route_request[$rr];    
41
+        foreach ($route_loop as $rr => $param) {
42
+            if ((substr($param, 0, 1) === '{')) {
43
+                $_GET[substr($param, 1, strlen($param)-2)] = $route_request[$rr];    
44 44
             }
45 45
     
46
-            if($this->check_parameter($param, $route_request[$rr])){
46
+            if ($this->check_parameter($param, $route_request[$rr])) {
47 47
                 return false;
48 48
             }
49 49
         }
@@ -52,22 +52,22 @@  discard block
 block discarded – undo
52 52
 
53 53
     protected function check_parameter(string $route_loop, string $route_request)
54 54
     {
55
-        return !( substr($route_loop,0,1) === '{' ) and $route_loop !== $route_request;
55
+        return !(substr($route_loop, 0, 1) === '{') and $route_loop !== $route_request;
56 56
     }
57 57
 
58 58
     protected function check_role()
59 59
     {
60
-        if(!array_key_exists('role', $this->getData()['POST'])){
60
+        if (!array_key_exists('role', $this->getData()['POST'])) {
61 61
             throw new Exception('O servidor não conseguiu identificar a finalidade deste formulário.');
62 62
         }
63 63
     }
64 64
 
65 65
     protected function hasProtocol(array $route, string $currentProtocol)
66 66
     {
67
-        $protocols = ( is_array($route['protocol']) ) ? $route['protocol'] : [ $route['protocol'] ];
67
+        $protocols = (is_array($route['protocol'])) ? $route['protocol'] : [$route['protocol']];
68 68
 
69
-        foreach($protocols as $protocol){
70
-            if($protocol !== $currentProtocol){
69
+        foreach ($protocols as $protocol) {
70
+            if ($protocol !== $currentProtocol) {
71 71
                 continue;
72 72
             }
73 73
         }
Please login to merge, or discard this patch.