Passed
Push — main ( f027b0...d3d850 )
by Sammy
07:15 queued 05:19
created
Controllers/ORM.php 1 patch
Spacing   +14 added lines, -14 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;
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
         $this->viewport('listing_fields', $listing_fields);
168 168
         $this->viewport('listing_template', $listing_template);
169 169
 
170
-        $this->viewport('route_new', $this->router()->hyp($class_name::model_type() . '_new'));
171
-        $this->viewport('route_export', $this->router()->hyp($class_name::model_type() . '_export'));
170
+        $this->viewport('route_new', $this->router()->hyp($class_name::model_type().'_new'));
171
+        $this->viewport('route_export', $this->router()->hyp($class_name::model_type().'_export'));
172 172
     }
173 173
 
174 174
     public function copy()
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         $this->errors = $model->save($this->operator()->getId()); // returns [errors]
201 201
         if (empty($this->errors())) {
202
-            $this->logger()->notice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_' . get_class($model)::model_type() . '_INSTANCE')]));
202
+            $this->logger()->notice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_'.get_class($model)::model_type().'_INSTANCE')]));
203 203
             return $model;
204 204
         }
205 205
         foreach ($this->errors() as $field => $error_msg) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     public function before_edit()
213 213
     {
214 214
         if (!is_null($this->router()->params('id')) && is_null($this->load_model)) {
215
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->modelClassName()::model_type() . '_INSTANCE')]));
215
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->modelClassName()::model_type().'_INSTANCE')]));
216 216
             $this->router()->hop($this->modelClassName()::model_type());
217 217
         }
218 218
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     public function destroy_confirm()
232 232
     {
233 233
         if (is_null($this->load_model)) {
234
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
234
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
235 235
             $this->router()->hop($this->model_type);
236 236
         }
237 237
 
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
     public function before_destroy() // default: checks for load_model and immortality, hops back to object on failure
244 244
     {
245 245
         if (is_null($this->load_model)) {
246
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
246
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
247 247
             $this->router()->hop($this->model_type);
248 248
         } elseif ($this->load_model->immortal()) {
249
-            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
249
+            $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
250 250
             $this->router()->hop($this->route_model($this->load_model));
251 251
         }
252 252
     }
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
         }
259 259
 
260 260
         if ($this->load_model->destroy($this->operator()->getId()) === false) {
261
-            $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', ['' . $this->load_model]));
261
+            $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model]));
262 262
             $this->routeBack($this->load_model);
263 263
         } else {
264
-            $this->logger()->notice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')]));
264
+            $this->logger()->notice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')]));
265 265
             $this->routeBack($this->model_type);
266 266
         }
267 267
     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     public function collection_to_csv($collection, $filename)
286 286
     {
287 287
       // TODO use Format/File/CSV class to generate file
288
-        $file_path = $this->get('settings.export.directory') . $filename . '.csv';
288
+        $file_path = $this->get('settings.export.directory').$filename.'.csv';
289 289
         $fp = fopen($file_path, 'w');
290 290
 
291 291
         $header = false;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
     public function route_new(ModelInterface $model): string
324 324
     {
325
-        return $this->router()->hyp(get_class($model)::model_type() . '_new');
325
+        return $this->router()->hyp(get_class($model)::model_type().'_new');
326 326
     }
327 327
 
328 328
     public function route_list(ModelInterface $model): string
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     {
335 335
         $route_params = [];
336 336
 
337
-        $route_name = get_class($model)::model_type() . '_';
337
+        $route_name = get_class($model)::model_type().'_';
338 338
         if ($model->isNew()) {
339 339
             $route_name .= 'new';
340 340
         } else {
Please login to merge, or discard this patch.