Passed
Push — master ( e25047...d6dcc5 )
by Fran
04:44
created
src/base/types/Api.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
     public function init()
75 75
     {
76 76
         parent::init();
77
-        Logger::log(get_called_class() . ' init', LOG_DEBUG);
77
+        Logger::log(get_called_class().' init', LOG_DEBUG);
78 78
         $this->domain = $this->getDomain();
79 79
         $this->hydrateRequestData();
80 80
         $this->hydrateOrders();
81
-        if($this instanceof CustomApi === false) {
81
+        if ($this instanceof CustomApi === false) {
82 82
             $this->createConnection($this->getTableMap());
83 83
         }
84 84
         $this->setLoaded(true);
85
-        Logger::log(get_called_class() . ' loaded', LOG_DEBUG);
85
+        Logger::log(get_called_class().' loaded', LOG_DEBUG);
86 86
     }
87 87
 
88 88
     /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     protected function hydrateOrders()
92 92
     {
93 93
         if (count($this->query)) {
94
-            Logger::log(get_called_class() . ' gathering query string', LOG_DEBUG);
94
+            Logger::log(get_called_class().' gathering query string', LOG_DEBUG);
95 95
             foreach ($this->query as $key => $value) {
96 96
                 if ($key === self::API_ORDER_FIELD && is_array($value)) {
97 97
                     foreach ($value as $field => $direction) {
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      */
109 109
     protected function extractPagination()
110 110
     {
111
-        Logger::log(get_called_class() . ' extract pagination start', LOG_DEBUG);
111
+        Logger::log(get_called_class().' extract pagination start', LOG_DEBUG);
112 112
         $page = (array_key_exists(self::API_PAGE_FIELD, $this->query)) ? $this->query[self::API_PAGE_FIELD] : 1;
113 113
         $limit = (array_key_exists(self::API_LIMIT_FIELD, $this->query)) ? $this->query[self::API_LIMIT_FIELD] : 100;
114
-        Logger::log(get_called_class() . ' extract pagination end', LOG_DEBUG);
114
+        Logger::log(get_called_class().' extract pagination end', LOG_DEBUG);
115 115
         return array($page, $limit);
116 116
     }
117 117
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     private function addOrders(ModelCriteria &$query)
124 124
     {
125
-        Logger::log(get_called_class() . ' extract orders start ', LOG_DEBUG);
125
+        Logger::log(get_called_class().' extract orders start ', LOG_DEBUG);
126 126
         $orderAdded = FALSE;
127 127
         $tableMap = $this->getTableMap();
128 128
         foreach ($this->order->getOrders() as $field => $direction) {
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
                 $orderAdded = TRUE;
131 131
                 if ($direction === Order::ASC) {
132 132
                     $query->addAscendingOrderByColumn($column->getPhpName());
133
-                } else {
133
+                }else {
134 134
                     $query->addDescendingOrderByColumn($column->getPhpName());
135 135
                 }
136 136
             }
137 137
         }
138 138
         if (!$orderAdded) {
139
-            foreach($this->getPkDbName() as $pk => $phpName) {
139
+            foreach ($this->getPkDbName() as $pk => $phpName) {
140 140
                 $query->addAscendingOrderByColumn($pk);
141 141
             }
142 142
         }
143
-        Logger::log(get_called_class() . ' extract orders end', LOG_DEBUG);
143
+        Logger::log(get_called_class().' extract orders end', LOG_DEBUG);
144 144
     }
145 145
 
146 146
     /**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             foreach ($this->query as $field => $value) {
156 156
                 if (self::API_COMBO_FIELD === $field) {
157 157
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
158
-                } elseif(!preg_match('/^__/', $field)) {
158
+                } elseif (!preg_match('/^__/', $field)) {
159 159
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
160 160
                 }
161 161
             }
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
             list($page, $limit) = $this->extractPagination();
177 177
             if ($limit == -1) {
178 178
                 $this->list = $query->find($this->con);
179
-            } else {
179
+            }else {
180 180
                 $this->list = $query->paginate($page, $limit, $this->con);
181 181
             }
182
-        } catch (\Exception $e) {
182
+        }catch (\Exception $e) {
183 183
             Logger::log($e->getMessage(), LOG_ERR);
184 184
         }
185 185
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $code = 200;
199 199
         list($return, $total, $pages) = $this->getList();
200 200
         $message = null;
201
-        if(!$total) {
201
+        if (!$total) {
202 202
             $message = i18n::_('No se han encontrado elementos para la búsqueda');
203 203
         }
204 204
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $pages = 1;
225 225
         $message = null;
226 226
         list($code, $return) = $this->getSingleResult($pk);
227
-        if($code !== 200) {
227
+        if ($code !== 200) {
228 228
             $message = i18n::_('No se ha encontrado el elemento solicitado');
229 229
         }
230 230
 
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
                 $status = 200;
254 254
                 $saved = TRUE;
255 255
                 $model = $this->model->toArray();
256
-            } else {
256
+            }else {
257 257
                 $message = i18n::_('No se ha podido guardar el modelo seleccionado');
258 258
             }
259
-        } catch (\Exception $e) {
260
-            $message = i18n::_('Ha ocurrido un error intentando guardar el elemento: ') .'<br>'. $e->getMessage();
259
+        }catch (\Exception $e) {
260
+            $message = i18n::_('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage();
261 261
             $context = [];
262
-            if(null !== $e->getPrevious()) {
262
+            if (null !== $e->getPrevious()) {
263 263
                 $context[] = $e->getPrevious()->getMessage();
264 264
             }
265 265
             Logger::log($e->getMessage(), LOG_CRIT, $context);
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
                     $updated = TRUE;
296 296
                     $status = 200;
297 297
                     $model = $this->model->toArray();
298
-                } else {
298
+                }else {
299 299
                     $message = i18n::_('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
300 300
                 }
301
-            } catch (\Exception $e) {
301
+            }catch (\Exception $e) {
302 302
                 $message = i18n::_('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
303 303
                 $context = [];
304
-                if(null !== $e->getPrevious()) {
304
+                if (null !== $e->getPrevious()) {
305 305
                     $context[] = $e->getPrevious()->getMessage();
306 306
                 }
307 307
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
308 308
             }
309
-        } else {
309
+        }else {
310 310
             $message = i18n::_('No se ha encontrado el modelo al que se hace referencia para actualizar');
311 311
         }
312 312
 
@@ -334,15 +334,15 @@  discard block
 block discarded – undo
334 334
                 $this->con->beginTransaction();
335 335
                 $this->hydrateModel($pk);
336 336
                 if (NULL !== $this->model) {
337
-                    if(method_exists('clearAllReferences', $this->model)) {
337
+                    if (method_exists('clearAllReferences', $this->model)) {
338 338
                         $this->model->clearAllReferences(true);
339 339
                     }
340 340
                     $this->model->delete($this->con);
341 341
                     $deleted = TRUE;
342 342
                 }
343
-            } catch (\Exception $e) {
343
+            }catch (\Exception $e) {
344 344
                 $context = [];
345
-                if(null !== $e->getPrevious()) {
345
+                if (null !== $e->getPrevious()) {
346 346
                     $context[] = $e->getPrevious()->getMessage();
347 347
                 }
348 348
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             $this->saveBulk();
373 373
             $saved = true;
374 374
             $status = 200;
375
-        } catch(\Exception $e) {
375
+        }catch (\Exception $e) {
376 376
             Logger::log($e->getMessage(), LOG_CRIT, $this->getRequest()->getData());
377 377
             $message = i18n::_('Bulk insert rolled back');
378 378
         }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
         /** @var CustomerTableMap $tableMap */
396 396
         $modelPk = ApiHelper::extractPrimaryKeyColumnName($this->getTableMap());
397
-        foreach($this->list->getData() as $data) {
397
+        foreach ($this->list->getData() as $data) {
398 398
             $return[] = ApiHelper::mapArrayObject($this->getModelNamespace(), $modelPk, $this->query, $data);
399 399
         }
400 400
         return $return;
@@ -411,20 +411,20 @@  discard block
 block discarded – undo
411 411
         try {
412 412
             $this->paginate();
413 413
             if (null !== $this->list) {
414
-                if(array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
414
+                if (array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
415 415
                     $return = $this->extractDataWithFormat();
416
-                } else {
416
+                }else {
417 417
                     $return = $this->list->toArray(null, false, TableMap::TYPE_PHPNAME, false);
418 418
                 }
419 419
                 $total = 0;
420 420
                 $pages = 0;
421
-                if($this->list instanceof PropelModelPager) {
421
+                if ($this->list instanceof PropelModelPager) {
422 422
                     $total = $this->list->getNbResults();
423 423
                     $pages = $this->list->getLastPage();
424 424
                 }
425 425
             }
426
-        } catch (\Exception $e) {
427
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
426
+        }catch (\Exception $e) {
427
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
428 428
         }
429 429
 
430 430
         return array($return, $total, $pages);
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
         $return = array();
443 443
         if (NULL === $model || !method_exists($model, 'toArray')) {
444 444
             $code = 404;
445
-        } else {
445
+        }else {
446 446
             $return = $model->toArray();
447 447
         }
448 448
 
Please login to merge, or discard this patch.
src/base/types/helpers/SlackHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
             'text' => 'PSFS Error notifier',
29 29
             'attachments' => [
30 30
                 [
31
-                    "text" => $file . (strlen($line) ? ' [' . $line . ']' : ''),
31
+                    "text" => $file.(strlen($line) ? ' ['.$line.']' : ''),
32 32
                     "color" => "danger",
33 33
                     "title" => $message,
34 34
                     'fallback' => 'PSFS Error notifier',
Please login to merge, or discard this patch.