Test Failed
Push — master ( ead203...921ad1 )
by
unknown
01:39
created
src/FrontQL/Adapter/Where/WhereAdapter.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
                     if($item == 'and')
74 74
                         $where = $where->and;
75 75
                     else if ($item == 'or')
76
-                       $where = $where->or;
76
+                        $where = $where->or;
77 77
                     else if ($item == 'nest')
78 78
                         $where = $where->nest();
79 79
                     else if ($item == 'unnest')
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,18 +59,18 @@
 block discarded – undo
59 59
     {
60 60
         $where = new Where();
61 61
 
62
-        foreach($jWhere as $item){
63
-            if(is_array($item)){
64
-                if(!in_array($item[0], $this->allowed)) {
62
+        foreach ($jWhere as $item) {
63
+            if (is_array($item)) {
64
+                if (!in_array($item[0], $this->allowed)) {
65 65
                     throw new InvalidCommandException();
66 66
                 }
67 67
                 $method = $item[0];
68 68
                 unset($item[0]);
69 69
                 $where = call_user_func_array([$where, $method], $item);
70 70
             }
71
-            if(is_string($item)){
72
-                if(in_array($item, $this->allowed))
73
-                    if($item == 'and')
71
+            if (is_string($item)) {
72
+                if (in_array($item, $this->allowed))
73
+                    if ($item == 'and')
74 74
                         $where = $where->and;
75 75
                     else if ($item == 'or')
76 76
                        $where = $where->or;
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -69,15 +69,16 @@
 block discarded – undo
69 69
                 $where = call_user_func_array([$where, $method], $item);
70 70
             }
71 71
             if(is_string($item)){
72
-                if(in_array($item, $this->allowed))
73
-                    if($item == 'and')
72
+                if(in_array($item, $this->allowed)) {
73
+                                    if($item == 'and')
74 74
                         $where = $where->and;
75
-                    else if ($item == 'or')
76
-                       $where = $where->or;
77
-                    else if ($item == 'nest')
78
-                        $where = $where->nest();
79
-                    else if ($item == 'unnest')
80
-                        $where = $where->unnest();
75
+                } else if ($item == 'or') {
76
+                                           $where = $where->or;
77
+                    } else if ($item == 'nest') {
78
+                                            $where = $where->nest();
79
+                    } else if ($item == 'unnest') {
80
+                                            $where = $where->unnest();
81
+                    }
81 82
             }
82 83
         }
83 84
         return $where;
Please login to merge, or discard this patch.
src/FrontQL/Adapter/Select/SelectAdapter.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,11 +88,11 @@
 block discarded – undo
88 88
         
89 89
         $limit = $this->getSelectPayload()->getLimit();
90 90
         if(!empty($limit))
91
-          $select->limit($this->getSelectPayload()->getLimit());
91
+            $select->limit($this->getSelectPayload()->getLimit());
92 92
         
93 93
         $offset = $this->getSelectPayload()->getOffset();
94 94
         if(!empty($offset))
95
-           $select->offset($this->getSelectPayload()->getOffset());
95
+            $select->offset($this->getSelectPayload()->getOffset());
96 96
 
97 97
         return $select;
98 98
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function getProtectedColumns()
54 54
     {
55
-        if(is_null($this->protectedColumns))
55
+        if (is_null($this->protectedColumns))
56 56
             $this->protectedColumns = [];
57 57
 
58 58
         return $this->protectedColumns;
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
         // Adapta o payload ao padrão do zend
81 81
         $select = new Select();
82 82
 
83
-        if(!is_null($this->getSelectPayload()->getOrder()))
83
+        if (!is_null($this->getSelectPayload()->getOrder()))
84 84
             $select->order($this->getSelectPayload()->getOrder());
85 85
 
86 86
         $select->columns($columns);
87 87
         $select->where($this->getSelectPayload()->getWhere());
88 88
         
89 89
         $limit = $this->getSelectPayload()->getLimit();
90
-        if(!empty($limit))
90
+        if (!empty($limit))
91 91
           $select->limit($this->getSelectPayload()->getLimit());
92 92
         
93 93
         $offset = $this->getSelectPayload()->getOffset();
94
-        if(!empty($offset))
94
+        if (!empty($offset))
95 95
            $select->offset($this->getSelectPayload()->getOffset());
96 96
 
97 97
         return $select;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function getProtectedColumns()
54 54
     {
55
-        if(is_null($this->protectedColumns))
56
-            $this->protectedColumns = [];
55
+        if(is_null($this->protectedColumns)) {
56
+                    $this->protectedColumns = [];
57
+        }
57 58
 
58 59
         return $this->protectedColumns;
59 60
     }
@@ -80,19 +81,22 @@  discard block
 block discarded – undo
80 81
         // Adapta o payload ao padrão do zend
81 82
         $select = new Select();
82 83
 
83
-        if(!is_null($this->getSelectPayload()->getOrder()))
84
-            $select->order($this->getSelectPayload()->getOrder());
84
+        if(!is_null($this->getSelectPayload()->getOrder())) {
85
+                    $select->order($this->getSelectPayload()->getOrder());
86
+        }
85 87
 
86 88
         $select->columns($columns);
87 89
         $select->where($this->getSelectPayload()->getWhere());
88 90
         
89 91
         $limit = $this->getSelectPayload()->getLimit();
90
-        if(!empty($limit))
91
-          $select->limit($this->getSelectPayload()->getLimit());
92
+        if(!empty($limit)) {
93
+                  $select->limit($this->getSelectPayload()->getLimit());
94
+        }
92 95
         
93 96
         $offset = $this->getSelectPayload()->getOffset();
94
-        if(!empty($offset))
95
-           $select->offset($this->getSelectPayload()->getOffset());
97
+        if(!empty($offset)) {
98
+                   $select->offset($this->getSelectPayload()->getOffset());
99
+        }
96 100
 
97 101
         return $select;
98 102
     }
Please login to merge, or discard this patch.
src/FrontQL/Adapter/Select/SelectPayload.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
     public function getColumns()
39 39
     {
40 40
         // Se nenhuma coluna foi definida todas serão retornadas
41
-        if(!isset($this->payload['columns']) || !is_array($this->payload['columns']))
41
+        if (!isset($this->payload['columns']) || !is_array($this->payload['columns']))
42 42
             return ['*'];
43 43
 
44 44
         $regex = '/^[a-zA-Z_][a-zA-Z0-9_]*$/';
45 45
         $columns = array();
46 46
 
47
-        foreach ($this->payload['columns'] as $column){
47
+        foreach ($this->payload['columns'] as $column) {
48 48
             // Valida o nome da coluna
49
-            if(!is_string($column) || !preg_match($regex, $column))
49
+            if (!is_string($column) || !preg_match($regex, $column))
50 50
                 throw new InvalidColumnNameException();
51 51
 
52 52
             $columns[] = $column;
53 53
         }
54 54
 
55
-        if(count($columns) == 0)
55
+        if (count($columns) == 0)
56 56
             return ['*'];
57 57
 
58 58
         return $columns;
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getLimit()
67 67
     {
68
-        if(!isset($this->payload['limit']))
68
+        if (!isset($this->payload['limit']))
69 69
             return 500;
70 70
 
71
-        if(!is_numeric($this->payload['limit']))
71
+        if (!is_numeric($this->payload['limit']))
72 72
             return 500;
73 73
 
74 74
         return (int) $this->payload['limit'];
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function getOffset()
83 83
     {
84
-        if(!isset($this->payload['offset']))
84
+        if (!isset($this->payload['offset']))
85 85
             return null;
86 86
 
87
-        if(!is_numeric($this->payload['offset']))
87
+        if (!is_numeric($this->payload['offset']))
88 88
             return null;
89 89
 
90 90
         return (int) $this->payload['offset'];
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $allowed = ['ASC', 'DESC'];
101 101
 
102
-        if(!isset($this->payload['order']) || !is_array($this->payload['order']))
102
+        if (!isset($this->payload['order']) || !is_array($this->payload['order']))
103 103
             return null;
104 104
 
105 105
         $orders = array();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function getWhere()
123 123
     {
124
-        if(!is_array($this->payload['where']))
124
+        if (!is_array($this->payload['where']))
125 125
             return [];
126 126
 
127 127
         $adapter = new WhereAdapter();
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,22 +38,25 @@  discard block
 block discarded – undo
38 38
     public function getColumns()
39 39
     {
40 40
         // Se nenhuma coluna foi definida todas serão retornadas
41
-        if(!isset($this->payload['columns']) || !is_array($this->payload['columns']))
42
-            return ['*'];
41
+        if(!isset($this->payload['columns']) || !is_array($this->payload['columns'])) {
42
+                    return ['*'];
43
+        }
43 44
 
44 45
         $regex = '/^[a-zA-Z_][a-zA-Z0-9_]*$/';
45 46
         $columns = array();
46 47
 
47 48
         foreach ($this->payload['columns'] as $column){
48 49
             // Valida o nome da coluna
49
-            if(!is_string($column) || !preg_match($regex, $column))
50
-                throw new InvalidColumnNameException();
50
+            if(!is_string($column) || !preg_match($regex, $column)) {
51
+                            throw new InvalidColumnNameException();
52
+            }
51 53
 
52 54
             $columns[] = $column;
53 55
         }
54 56
 
55
-        if(count($columns) == 0)
56
-            return ['*'];
57
+        if(count($columns) == 0) {
58
+                    return ['*'];
59
+        }
57 60
 
58 61
         return $columns;
59 62
     }
@@ -65,11 +68,13 @@  discard block
 block discarded – undo
65 68
      */
66 69
     public function getLimit()
67 70
     {
68
-        if(!isset($this->payload['limit']))
69
-            return 500;
71
+        if(!isset($this->payload['limit'])) {
72
+                    return 500;
73
+        }
70 74
 
71
-        if(!is_numeric($this->payload['limit']))
72
-            return 500;
75
+        if(!is_numeric($this->payload['limit'])) {
76
+                    return 500;
77
+        }
73 78
 
74 79
         return (int) $this->payload['limit'];
75 80
     }
@@ -81,11 +86,13 @@  discard block
 block discarded – undo
81 86
      */
82 87
     public function getOffset()
83 88
     {
84
-        if(!isset($this->payload['offset']))
85
-            return null;
89
+        if(!isset($this->payload['offset'])) {
90
+                    return null;
91
+        }
86 92
 
87
-        if(!is_numeric($this->payload['offset']))
88
-            return null;
93
+        if(!is_numeric($this->payload['offset'])) {
94
+                    return null;
95
+        }
89 96
 
90 97
         return (int) $this->payload['offset'];
91 98
     }
@@ -99,8 +106,9 @@  discard block
 block discarded – undo
99 106
     {
100 107
         $allowed = ['ASC', 'DESC'];
101 108
 
102
-        if(!isset($this->payload['order']) || !is_array($this->payload['order']))
103
-            return null;
109
+        if(!isset($this->payload['order']) || !is_array($this->payload['order'])) {
110
+                    return null;
111
+        }
104 112
 
105 113
         $orders = array();
106 114
 
@@ -121,8 +129,9 @@  discard block
 block discarded – undo
121 129
      */
122 130
     public function getWhere()
123 131
     {
124
-        if(!is_array($this->payload['where']))
125
-            return [];
132
+        if(!is_array($this->payload['where'])) {
133
+                    return [];
134
+        }
126 135
 
127 136
         $adapter = new WhereAdapter();
128 137
         $where = $adapter->fromArray($this->payload['where']);
Please login to merge, or discard this patch.