Passed
Push — master ( d59fda...dc7489 )
by Fran
03:09
created
src/base/types/Api.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function init()
55 55
     {
56 56
         parent::init();
57
-        Logger::log(static::class . ' init', LOG_DEBUG);
57
+        Logger::log(static::class.' init', LOG_DEBUG);
58 58
         $this->domain = $this->getDomain();
59 59
         $this->hydrateRequestData();
60 60
         $this->hydrateOrders();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         }
64 64
         $this->checkFieldType();
65 65
         $this->setLoaded(true);
66
-        Logger::log(static::class . ' loaded', LOG_DEBUG);
66
+        Logger::log(static::class.' loaded', LOG_DEBUG);
67 67
     }
68 68
 
69 69
     private function checkActions($method)
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
                 $status = 200;
160 160
                 $saved = TRUE;
161 161
                 $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
162
-            } else {
162
+            }else {
163 163
                 $message = t('No se ha podido guardar el modelo seleccionado');
164 164
             }
165
-        } catch (\Exception $e) {
166
-            if(Config::getParam('debug')) {
167
-                $message = t('Ha ocurrido un error intentando guardar el elemento: ') . '<br>' . $e->getMessage();
168
-            } else {
169
-                $message = t('Ha ocurrido un error intentando guardar el elemento: ') . '<br>' . $e->getCode();
165
+        }catch (\Exception $e) {
166
+            if (Config::getParam('debug')) {
167
+                $message = t('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage();
168
+            }else {
169
+                $message = t('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getCode();
170 170
             }
171 171
             $context = [];
172 172
             if (null !== $e->getPrevious()) {
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
                     $updated = TRUE;
206 206
                     $status = 200;
207 207
                     $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
208
-                } else {
208
+                }else {
209 209
                     $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
210 210
                 }
211
-            } catch (\Exception $e) {
212
-                if(Config::getParam('debug')) {
213
-                    $message = t('Ha ocurrido un error intentando actualizar el elemento: ') . '<br>' . $e->getMessage();
214
-                } else {
215
-                    $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs: ') . '<br>' . $e->getCode();
211
+            }catch (\Exception $e) {
212
+                if (Config::getParam('debug')) {
213
+                    $message = t('Ha ocurrido un error intentando actualizar el elemento: ').'<br>'.$e->getMessage();
214
+                }else {
215
+                    $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs: ').'<br>'.$e->getCode();
216 216
                 }
217 217
                 $context = [];
218 218
                 if (null !== $e->getPrevious()) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                 }
221 221
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
222 222
             }
223
-        } else {
223
+        }else {
224 224
             $message = t('No se ha encontrado el modelo al que se hace referencia para actualizar');
225 225
         }
226 226
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                     $this->model->delete($this->con);
255 255
                     $deleted = TRUE;
256 256
                 }
257
-            } catch (\Exception $e) {
257
+            }catch (\Exception $e) {
258 258
                 $context = [];
259 259
                 if (null !== $e->getPrevious()) {
260 260
                     $context[] = $e->getPrevious()->getMessage();
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             $this->saveBulk();
287 287
             $saved = true;
288 288
             $status = 200;
289
-        } catch (\Exception $e) {
289
+        }catch (\Exception $e) {
290 290
             Logger::log($e->getMessage(), LOG_CRIT, $this->getRequest()->getData());
291 291
             $message = t('Bulk insert rolled back');
292 292
         }
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             if (null !== $this->list) {
319 319
                 if (array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
320 320
                     $return = $this->extractDataWithFormat();
321
-                } else {
321
+                }else {
322 322
                     $return = $this->list->toArray(null, false, $this->fieldType ?: TableMap::TYPE_PHPNAME, false);
323 323
                 }
324 324
                 $total = 0;
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
                     $pages = 1;
332 332
                 }
333 333
             }
334
-        } catch (\Exception $e) {
335
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
334
+        }catch (\Exception $e) {
335
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
336 336
         }
337 337
 
338 338
         return array($return, $total, $pages);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         $return = array();
351 351
         if (NULL === $model || !method_exists($model, 'toArray')) {
352 352
             $code = 404;
353
-        } else {
353
+        }else {
354 354
             $return = $model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
355 355
         }
356 356
 
Please login to merge, or discard this patch.