Passed
Push — main ( d0474b...4f9f31 )
by Sammy
01:40
created
TableModel.php 1 patch
Braces   +33 added lines, -20 removed lines patch added patch discarded remove patch
@@ -121,51 +121,64 @@
 block discarded – undo
121 121
 
122 122
       foreach($table->columns() as $column_name => $column)
123 123
       {
124
-        if(isset($filters[$column_name]) && is_string($filters[$column_name]))
125
-          $Query->aw_eq($column_name, $filters[$column_name]);
124
+        if(isset($filters[$column_name]) && is_string($filters[$column_name])) {
125
+                  $Query->aw_eq($column_name, $filters[$column_name]);
126
+        }
126 127
       }
127 128
 
128 129
       if(is_subclass_of($event = new $class(), '\HexMakina\kadro\Models\Interfaces\EventInterface'))
129 130
       {
130
-        if(!empty($filters['date_start']))
131
-          $Query->aw_gte($event->event_field(), $filters['date_start'], $Query->table_label(), ':filter_date_start');
131
+        if(!empty($filters['date_start'])) {
132
+                  $Query->aw_gte($event->event_field(), $filters['date_start'], $Query->table_label(), ':filter_date_start');
133
+        }
132 134
 
133
-        if(!empty($filters['date_stop']))
134
-          $Query->aw_lte($event->event_field(), $filters['date_stop'], $Query->table_label(), ':filter_date_stop');
135
+        if(!empty($filters['date_stop'])) {
136
+                  $Query->aw_lte($event->event_field(), $filters['date_stop'], $Query->table_label(), ':filter_date_stop');
137
+        }
135 138
 
136
-        if(empty($options['order_by']))
137
-          $Query->order_by([$event->event_field(), 'DESC']);
139
+        if(empty($options['order_by'])) {
140
+                  $Query->order_by([$event->event_field(), 'DESC']);
141
+        }
138 142
       }
139 143
 
140
-      if(isset($filters['content'])) $Query->aw_filter_content($filters['content']);
144
+      if(isset($filters['content'])) {
145
+          $Query->aw_filter_content($filters['content']);
146
+      }
141 147
 
142 148
       if(isset($filters['ids']))
143 149
       {
144
-        if(empty($filters['ids']))
145
-          $Query->and_where('1=0'); // TODO: this is a new low.. find another way to cancel query
146
-        else $Query->aw_numeric_in('id', $filters['ids'], $Query->table_label());
150
+        if(empty($filters['ids'])) {
151
+                  $Query->and_where('1=0');
152
+        }
153
+        // TODO: this is a new low.. find another way to cancel query
154
+        else {
155
+            $Query->aw_numeric_in('id', $filters['ids'], $Query->table_label());
156
+        }
147 157
       }
148 158
 
149
-      if(isset($options['order_by'])) // TODO commenting required about the array situation
159
+      if(isset($options['order_by'])) {
160
+          // TODO commenting required about the array situation
150 161
       {
151 162
         $order_by = $options['order_by'];
163
+      }
152 164
 
153
-        if(is_string($order_by))
154
-          $Query->order_by($order_by);
155
-
156
-        elseif(is_array($order_by))
157
-          foreach($options['order_by'] as $order_by)
165
+        if(is_string($order_by)) {
166
+                  $Query->order_by($order_by);
167
+        } elseif(is_array($order_by)) {
168
+                  foreach($options['order_by'] as $order_by)
158 169
           {
159 170
             if(!isset($order_by[2]))
160 171
               array_unshift($order_by, '');
172
+        }
161 173
 
162 174
             list($order_table, $order_field, $order_direction) = $order_by;
163 175
             $Query->order_by([$order_table ?? '', $order_field, $order_direction]);
164 176
           }
165 177
       }
166 178
 
167
-      if(isset($options['limit']) && is_array($options['limit']))
168
-        $Query->limit($options['limit'][1], $options['limit'][0]);
179
+      if(isset($options['limit']) && is_array($options['limit'])) {
180
+              $Query->limit($options['limit'][1], $options['limit'][0]);
181
+      }
169 182
 
170 183
       return $Query;
171 184
     }
Please login to merge, or discard this patch.