Passed
Push — master ( d0de28...7219b2 )
by Henri
01:25
created
src/FilterTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Exception;
6 6
 
7
-trait FilterTrait{
7
+trait FilterTrait {
8 8
     protected function check_filtering(array $route)
9 9
     {
10
-        $filters = (is_array($route['filters'])) ? $route['filters'] : [ $route['filters'] ];
10
+        $filters = (is_array($route['filters'])) ? $route['filters'] : [$route['filters']];
11 11
 
12
-        foreach($filters as $filter){
13
-            if(is_null($filter)){
12
+        foreach ($filters as $filter) {
13
+            if (is_null($filter)) {
14 14
                 continue;
15 15
             }
16 16
             $this->check_filter($filter);
@@ -19,24 +19,24 @@  discard block
 block discarded – undo
19 19
 
20 20
     protected function check_filter(string $filtername)
21 21
     {
22
-        if(count(explode(':',$filtername)) != 2){
22
+        if (count(explode(':', $filtername)) != 2) {
23 23
             throw new Exception("Wrongly configured filter: {$filtername}.");
24 24
         }
25 25
 
26
-        $filter = $this->check_filClassExist(explode(':',$filtername)[0]);
26
+        $filter = $this->check_filClassExist(explode(':', $filtername)[0]);
27 27
 
28
-        if(!$filter->check(explode(':',$filtername)[1])){
29
-            throw new Exception($filter->getMessage(explode(':',$filtername)[1]));
28
+        if (!$filter->check(explode(':', $filtername)[1])) {
29
+            throw new Exception($filter->getMessage(explode(':', $filtername)[1]));
30 30
         }
31 31
     }
32 32
 
33 33
     protected function check_filClassExist(string $class)
34 34
     {
35
-        if(class_exists(ROUTER_CONFIG['filter.namespace']."\\{$class}")){
35
+        if (class_exists(ROUTER_CONFIG['filter.namespace']."\\{$class}")) {
36 36
             $filter = ROUTER_CONFIG['filter.namespace']."\\{$class}";
37 37
             return new $filter();
38 38
         }
39
-        if(file_exists(ROUTER_CONFIG['path.filters'].$class.'.php')){
39
+        if (file_exists(ROUTER_CONFIG['path.filters'].$class.'.php')) {
40 40
             require_once(ROUTER_CONFIG['path.filters'].$class.'.php');
41 41
             $filter = ROUTER_CONFIG['filter.namespace']."\\{$class}";
42 42
             return new $filter();
Please login to merge, or discard this patch.