Passed
Push — main ( 6b66f0...59ef6c )
by Sammy
01:48
created
Controllers/ORM.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $ret = $this->modelType();
59 59
 
60 60
         if (!is_null($suffix)) {
61
-            $ret .= '_' . $suffix;
61
+            $ret .= '_'.$suffix;
62 62
         }
63 63
 
64 64
         return $ret;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     {
104 104
         if (is_null($this->model_class_name)) {
105 105
             preg_match(Configuration::RX_MVC, get_called_class(), $m);
106
-            $this->model_class_name = $this->get('Models\\' . $m[2] . '::class');
106
+            $this->model_class_name = $this->get('Models\\'.$m[2].'::class');
107 107
         }
108 108
 
109 109
         return $this->model_class_name;
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
         $this->viewport('listing_fields', $listing_fields);
156 156
         $this->viewport('listing_template', $listing_template);
157 157
 
158
-        $this->viewport('route_new', $this->router()->hyp($class_name::model_type() . '_new'));
159
-        $this->viewport('route_export', $this->router()->hyp($class_name::model_type() . '_export'));
158
+        $this->viewport('route_new', $this->router()->hyp($class_name::model_type().'_new'));
159
+        $this->viewport('route_export', $this->router()->hyp($class_name::model_type().'_export'));
160 160
     }
161 161
 
162
-    private function listing_fields_from_listing($class_name, $listing){
162
+    private function listing_fields_from_listing($class_name, $listing) {
163 163
       $ret = [];
164 164
 
165 165
       $current = current($listing);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
       return $listing_fields;
174 174
     }
175 175
 
176
-    private function listing_fields_from_table($class_name){
176
+    private function listing_fields_from_table($class_name) {
177 177
       $ret = [];
178 178
       $hidden_columns = ['created_by', 'created_on', 'password'];
179 179
       foreach ($class_name::table()->columns() as $column) {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
       return $ret;
185 185
     }
186 186
 
187
-    private function listing_fields($class_name, $listing){
187
+    private function listing_fields($class_name, $listing) {
188 188
       $listing_fields = [];
189 189
 
190 190
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     {
220 220
         $this->errors = $model->save($this->operator()->getId()); // returns [errors]
221 221
         if (empty($this->errors())) {
222
-            $this->logger()->notice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_' . get_class($model)::model_type() . '_INSTANCE')]));
222
+            $this->logger()->notice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_'.get_class($model)::model_type().'_INSTANCE')]));
223 223
             return $model;
224 224
         }
225 225
         foreach ($this->errors() as $field => $error_msg) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     public function before_edit()
233 233
     {
234 234
         if (!is_null($this->router()->params('id')) && is_null($this->load_model)) {
235
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->modelClassName()::model_type() . '_INSTANCE')]));
235
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->modelClassName()::model_type().'_INSTANCE')]));
236 236
             $this->router()->hop($this->modelClassName()::model_type());
237 237
         }
238 238
     }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     public function destroy_confirm()
252 252
     {
253 253
         if (is_null($this->load_model)) {
254
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
254
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
255 255
             $this->router()->hop($this->model_type);
256 256
         }
257 257
 
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
     public function before_destroy() // default: checks for load_model and immortality, hops back to object on failure
264 264
     {
265 265
         if (is_null($this->load_model)) {
266
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
266
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
267 267
             $this->router()->hop($this->model_type);
268 268
         } elseif ($this->load_model->immortal()) {
269
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
269
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
270 270
             $this->router()->hop($this->route_model($this->load_model));
271 271
         }
272 272
     }
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
         }
279 279
 
280 280
         if ($this->load_model->destroy($this->operator()->getId()) === false) {
281
-            $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', ['' . $this->load_model]));
281
+            $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model]));
282 282
             $this->routeBack($this->load_model);
283 283
         } else {
284
-            $this->logger()->notice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
284
+            $this->logger()->notice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
285 285
             $this->routeBack($this->model_type);
286 286
         }
287 287
     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function collection_to_csv($collection, $filename)
306 306
     {
307 307
       // TODO use Format/File/CSV class to generate file
308
-        $file_path = $this->get('settings.export.directory') . $filename . '.csv';
308
+        $file_path = $this->get('settings.export.directory').$filename.'.csv';
309 309
         $fp = fopen($file_path, 'w');
310 310
 
311 311
         $header = false;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
     public function route_new(ModelInterface $model): string
344 344
     {
345
-        return $this->router()->hyp(get_class($model)::model_type() . '_new');
345
+        return $this->router()->hyp(get_class($model)::model_type().'_new');
346 346
     }
347 347
 
348 348
     public function route_list(ModelInterface $model): string
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     {
355 355
         $route_params = [];
356 356
 
357
-        $route_name = get_class($model)::model_type() . '_';
357
+        $route_name = get_class($model)::model_type().'_';
358 358
         if ($model->isNew()) {
359 359
             $route_name .= 'new';
360 360
         } else {
Please login to merge, or discard this patch.