Passed
Push — master ( 6dd2bc...be6a60 )
by Fran
03:47
created
src/base/extension/traits/JsTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
             foreach ($compiledFiles as $file) {
25 25
                 echo "\t\t<script type='text/javascript' src='{$file}'></script>\n";
26 26
             }
27
-        } else {
28
-            echo "\t\t<script type='text/javascript' src='" . $baseUrl . "/js/" . $hash . ".js'" .
27
+        }else {
28
+            echo "\t\t<script type='text/javascript' src='".$baseUrl."/js/".$hash.".js'".
29 29
                 //" crossorigin='anonymous' integrity='sha384-" . $sri . "'></script>\n";
30 30
                 "></script>\n";
31 31
         }
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
      */
43 43
     protected function putDebugJs($pathParts, $base, $file, $hash, array &$compiledFiles)
44 44
     {
45
-        $filePath = $hash . "_" . $pathParts[count($pathParts) - 1];
46
-        $compiledFiles[] = "/js/" . $filePath;
45
+        $filePath = $hash."_".$pathParts[count($pathParts) - 1];
46
+        $compiledFiles[] = "/js/".$filePath;
47 47
         $data = "";
48
-        if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file)) {
48
+        if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file)) {
49 49
             $data = file_get_contents($file);
50
-            AssetsHelper::storeContents($base . $filePath, $data);
50
+            AssetsHelper::storeContents($base.$filePath, $data);
51 51
         }
52 52
         return $data;
53 53
     }
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected function compileJs(array $files, $basePath, $hash, array &$compiledFiles)
65 65
     {
66
-        $base = $basePath . "js" . DIRECTORY_SEPARATOR;
66
+        $base = $basePath."js".DIRECTORY_SEPARATOR;
67 67
         $debug = Config::getParam('debug');
68
-        if ($debug || !file_exists($base . $hash . ".js")) {
68
+        if ($debug || !file_exists($base.$hash.".js")) {
69 69
             $data = '';
70 70
             if (0 < count($files)) {
71 71
                 $minifier = new JS();
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
                     if (file_exists($file)) {
75 75
                         if ($debug) {
76 76
                             $data = $this->putDebugJs($pathParts, $base, $file, $hash, $compiledFiles);
77
-                        } elseif (!file_exists($base . $hash . ".js")) {
77
+                        } elseif (!file_exists($base.$hash.".js")) {
78 78
                             $minifier->add($file);
79 79
                             //$data = $this->putProductionJs($base, $file, $data);
80 80
                         }
81 81
                     }
82 82
                 }
83
-                if($debug) {
84
-                    AssetsHelper::storeContents($base . $hash . ".js", $data);
85
-                } else {
83
+                if ($debug) {
84
+                    AssetsHelper::storeContents($base.$hash.".js", $data);
85
+                }else {
86 86
                     $this->dumpJs($hash, $base, $minifier);
87 87
                 }
88 88
                 unset($minifier);
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
         ini_set('memory_limit', -1);
104 104
         GeneratorHelper::createDir($base);
105 105
         if (Config::getParam('assets.obfuscate', false)) {
106
-            $minifier->gzip($base . $hash . ".js");
107
-        } else {
108
-            $minifier->minify($base . $hash . ".js");
106
+            $minifier->gzip($base.$hash.".js");
107
+        }else {
108
+            $minifier->minify($base.$hash.".js");
109 109
         }
110 110
     }
111 111
 }
Please login to merge, or discard this patch.
src/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
             $objects = scandir($dir);
24 24
             foreach ($objects as $object) {
25 25
                 if ($object != "." && $object != "..") {
26
-                    if (filetype($dir . "/" . $object) == "dir") {
27
-                        self::deleteDir($dir . "/" . $object);
28
-                    } else {
29
-                        unlink($dir . "/" . $object);
26
+                    if (filetype($dir."/".$object) == "dir") {
27
+                        self::deleteDir($dir."/".$object);
28
+                    }else {
29
+                        unlink($dir."/".$object);
30 30
                     }
31 31
                 }
32 32
             }
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $rootDirs = array("css", "js", "media", "font");
44 44
         foreach ($rootDirs as $dir) {
45
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
45
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
46 46
                 try {
47
-                    self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir);
48
-                } catch (\Exception $e) {
47
+                    self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir);
48
+                }catch (\Exception $e) {
49 49
                     syslog(LOG_INFO, $e->getMessage());
50 50
                 }
51 51
             }
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public static function createDir($dir)
61 61
     {
62
-        if(!empty($dir)) {
62
+        if (!empty($dir)) {
63 63
             try {
64 64
                 if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
65
-                    throw new \Exception(t('Can\'t create directory ') . $dir);
65
+                    throw new \Exception(t('Can\'t create directory ').$dir);
66 66
                 }
67
-            } catch (\Exception $e) {
67
+            }catch (\Exception $e) {
68 68
                 syslog(LOG_WARNING, $e->getMessage());
69 69
                 if (!file_exists(dirname($dir))) {
70
-                    throw new GeneratorException($e->getMessage() . $dir);
70
+                    throw new GeneratorException($e->getMessage().$dir);
71 71
                 }
72 72
             }
73 73
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public static function getTemplatePath()
81 81
     {
82
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
82
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
83 83
         return realpath($path);
84 84
     }
85 85
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
      * @throws \ReflectionException
99 99
      */
100 100
     public static function checkCustomNamespaceApi($namespace) {
101
-        if(!empty($namespace)) {
102
-            if(class_exists($namespace)) {
101
+        if (!empty($namespace)) {
102
+            if (class_exists($namespace)) {
103 103
                 $reflector = new \ReflectionClass($namespace);
104
-                if(!$reflector->isSubclassOf(Api::class)) {
104
+                if (!$reflector->isSubclassOf(Api::class)) {
105 105
                     throw new GeneratorException(t('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501);
106
-                } elseif(!$reflector->isAbstract()) {
106
+                } elseif (!$reflector->isAbstract()) {
107 107
                     throw new GeneratorException(t('La clase definida debe ser abstracta'), 501);
108 108
                 }
109
-            } else {
109
+            }else {
110 110
                 throw new GeneratorException(t('La clase definida para extender la API no existe'), 501);
111 111
             }
112 112
         }
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public static function createRoot($path = WEB_DIR, OutputInterface $output = null, $quiet = false) {
122 122
 
123
-        if(null === $output) {
123
+        if (null === $output) {
124 124
             $output = new ConsoleOutput();
125 125
         }
126 126
 
127 127
         GeneratorHelper::createDir($path);
128 128
         $paths = array("js", "css", "img", "media", "font");
129 129
         foreach ($paths as $htmlPath) {
130
-            GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath);
130
+            GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath);
131 131
         }
132 132
 
133 133
         // Generates the root needed files
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
         ];
141 141
         $output->writeln('Start creating html files');
142 142
         foreach ($files as $templates => $filename) {
143
-            $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig');
144
-            if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) {
145
-                if(!$quiet) {
146
-                    $output->writeln('Can\t create the file ' . $filename);
143
+            $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig');
144
+            if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) {
145
+                if (!$quiet) {
146
+                    $output->writeln('Can\t create the file '.$filename);
147 147
                 }
148
-            } else {
149
-                if(!$quiet) {
150
-                    $output->writeln($filename . ' created successfully');
148
+            }else {
149
+                if (!$quiet) {
150
+                    $output->writeln($filename.' created successfully');
151 151
                 }
152 152
             }
153 153
         }
154 154
 
155 155
         //Export base locale translations
156
-        if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) {
157
-            GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
158
-            self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
156
+        if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) {
157
+            GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
158
+            self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
159 159
         }
160 160
     }
161 161
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
     {
172 172
         if (file_exists($filenamePath)) {
173 173
             $destfolder = basename($filenamePath);
174
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
174
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
175 175
                 if (is_dir($filenamePath)) {
176
-                    self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
177
-                } else {
178
-                    if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
179
-                        throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
176
+                    self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
177
+                }else {
178
+                    if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
179
+                        throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
180 180
                     }
181 181
                 }
182 182
             }
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
         self::createDir($dst);
195 195
         while (false !== ($file = readdir($dir))) {
196 196
             if (($file != '.') && ($file != '..')) {
197
-                if (is_dir($src . '/' . $file)) {
198
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
199
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
200
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
197
+                if (is_dir($src.'/'.$file)) {
198
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
199
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
200
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
201 201
                 }
202 202
             }
203 203
         }
Please login to merge, or discard this patch.
src/base/types/Api.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
     public function init()
82 82
     {
83 83
         parent::init();
84
-        Logger::log(static::class . ' init', LOG_DEBUG);
84
+        Logger::log(static::class.' init', LOG_DEBUG);
85 85
         $this->domain = $this->getDomain();
86 86
         $this->hydrateRequestData();
87 87
         $this->hydrateOrders();
88
-        if($this instanceof CustomApi === false) {
88
+        if ($this instanceof CustomApi === false) {
89 89
             $this->createConnection($this->getTableMap());
90 90
         }
91 91
         $this->checkFieldType();
92 92
         $this->setLoaded(true);
93
-        Logger::log(static::class . ' loaded', LOG_DEBUG);
93
+        Logger::log(static::class.' loaded', LOG_DEBUG);
94 94
     }
95 95
 
96 96
     private function checkActions($method) {
97
-        switch($method) {
97
+        switch ($method) {
98 98
             default:
99 99
             case 'modelList': $this->action = self::API_ACTION_LIST; break;
100 100
             case 'get': $this->action = self::API_ACTION_GET; break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     protected function hydrateOrders()
112 112
     {
113 113
         if (count($this->query)) {
114
-            Logger::log(static::class . ' gathering query string', LOG_DEBUG);
114
+            Logger::log(static::class.' gathering query string', LOG_DEBUG);
115 115
             foreach ($this->query as $key => $value) {
116 116
                 if ($key === self::API_ORDER_FIELD) {
117 117
                     $orders = json_decode($value, true);
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
      */
130 130
     protected function extractPagination()
131 131
     {
132
-        Logger::log(static::class . ' extract pagination start', LOG_DEBUG);
132
+        Logger::log(static::class.' extract pagination start', LOG_DEBUG);
133 133
         $page = array_key_exists(self::API_PAGE_FIELD, $this->query) ? $this->query[self::API_PAGE_FIELD] : 1;
134 134
         $limit = array_key_exists(self::API_LIMIT_FIELD, $this->query) ? $this->query[self::API_LIMIT_FIELD] : 100;
135
-        Logger::log(static::class . ' extract pagination end', LOG_DEBUG);
135
+        Logger::log(static::class.' extract pagination end', LOG_DEBUG);
136 136
         return array($page, (int)$limit);
137 137
     }
138 138
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     private function addOrders(ModelCriteria &$query)
145 145
     {
146
-        Logger::log(static::class . ' extract orders start ', LOG_DEBUG);
146
+        Logger::log(static::class.' extract orders start ', LOG_DEBUG);
147 147
         $orderAdded = FALSE;
148 148
         $tableMap = $this->getTableMap();
149 149
         foreach ($this->order->getOrders() as $field => $direction) {
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
                 $orderAdded = TRUE;
152 152
                 if ($direction === Order::ASC) {
153 153
                     $query->addAscendingOrderByColumn($column->getPhpName());
154
-                } else {
154
+                }else {
155 155
                     $query->addDescendingOrderByColumn($column->getPhpName());
156 156
                 }
157 157
             }
158 158
         }
159 159
         if (!$orderAdded) {
160 160
             $pks = $this->getPkDbName();
161
-            foreach(array_keys($pks) as $key) {
161
+            foreach (array_keys($pks) as $key) {
162 162
                 $query->addAscendingOrderByColumn($key);
163 163
             }
164 164
         }
165
-        Logger::log(static::class . ' extract orders end', LOG_DEBUG);
165
+        Logger::log(static::class.' extract orders end', LOG_DEBUG);
166 166
     }
167 167
 
168 168
     /**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             foreach ($this->query as $field => $value) {
178 178
                 if (self::API_COMBO_FIELD === $field) {
179 179
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
180
-                } elseif(!preg_match('/^__/', $field)) {
180
+                } elseif (!preg_match('/^__/', $field)) {
181 181
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
182 182
                 }
183 183
             }
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
             list($page, $limit) = $this->extractPagination();
199 199
             if ($limit === -1) {
200 200
                 $this->list = $query->find($this->con);
201
-            } else {
201
+            }else {
202 202
                 $this->list = $query->paginate($page, $limit, $this->con);
203 203
             }
204
-        } catch (\Exception $e) {
204
+        }catch (\Exception $e) {
205 205
             Logger::log($e->getMessage(), LOG_ERR);
206 206
         }
207 207
     }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $code = 200;
221 221
         list($return, $total, $pages) = $this->getList();
222 222
         $message = null;
223
-        if(!$total) {
223
+        if (!$total) {
224 224
             $message = t('No se han encontrado elementos para la búsqueda');
225 225
         }
226 226
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $pages = 1;
247 247
         $message = null;
248 248
         list($code, $return) = $this->getSingleResult($pk);
249
-        if($code !== 200) {
249
+        if ($code !== 200) {
250 250
             $message = t('No se ha encontrado el elemento solicitado');
251 251
         }
252 252
 
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
                 $status = 200;
276 276
                 $saved = TRUE;
277 277
                 $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
278
-            } else {
278
+            }else {
279 279
                 $message = t('No se ha podido guardar el modelo seleccionado');
280 280
             }
281
-        } catch (\Exception $e) {
282
-            $message = t('Ha ocurrido un error intentando guardar el elemento: ') .'<br>'. $e->getMessage();
281
+        }catch (\Exception $e) {
282
+            $message = t('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage();
283 283
             $context = [];
284
-            if(null !== $e->getPrevious()) {
284
+            if (null !== $e->getPrevious()) {
285 285
                 $context[] = $e->getPrevious()->getMessage();
286 286
             }
287 287
             Logger::log($e->getMessage(), LOG_CRIT, $context);
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
                     $updated = TRUE;
318 318
                     $status = 200;
319 319
                     $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
320
-                } else {
320
+                }else {
321 321
                     $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
322 322
                 }
323
-            } catch (\Exception $e) {
323
+            }catch (\Exception $e) {
324 324
                 $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
325 325
                 $context = [];
326
-                if(null !== $e->getPrevious()) {
326
+                if (null !== $e->getPrevious()) {
327 327
                     $context[] = $e->getPrevious()->getMessage();
328 328
                 }
329 329
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
330 330
             }
331
-        } else {
331
+        }else {
332 332
             $message = t('No se ha encontrado el modelo al que se hace referencia para actualizar');
333 333
         }
334 334
 
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
                 $this->con->beginTransaction();
357 357
                 $this->hydrateModel($pk);
358 358
                 if (NULL !== $this->model) {
359
-                    if(method_exists('clearAllReferences', $this->model)) {
359
+                    if (method_exists('clearAllReferences', $this->model)) {
360 360
                         $this->model->clearAllReferences(true);
361 361
                     }
362 362
                     $this->model->delete($this->con);
363 363
                     $deleted = TRUE;
364 364
                 }
365
-            } catch (\Exception $e) {
365
+            }catch (\Exception $e) {
366 366
                 $context = [];
367
-                if(null !== $e->getPrevious()) {
367
+                if (null !== $e->getPrevious()) {
368 368
                     $context[] = $e->getPrevious()->getMessage();
369 369
                 }
370 370
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             $this->saveBulk();
394 394
             $saved = true;
395 395
             $status = 200;
396
-        } catch(\Exception $e) {
396
+        }catch (\Exception $e) {
397 397
             Logger::log($e->getMessage(), LOG_CRIT, $this->getRequest()->getData());
398 398
             $message = t('Bulk insert rolled back');
399 399
         }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
         /** @var CustomerTableMap $tableMap */
417 417
         $modelPk = ApiHelper::extractPrimaryKeyColumnName($this->getTableMap());
418
-        foreach($this->list->getData() as $data) {
418
+        foreach ($this->list->getData() as $data) {
419 419
             $return[] = ApiHelper::mapArrayObject($this->getModelNamespace(), $modelPk, $this->query, $data);
420 420
         }
421 421
         return $return;
@@ -432,23 +432,23 @@  discard block
 block discarded – undo
432 432
         try {
433 433
             $this->paginate();
434 434
             if (null !== $this->list) {
435
-                if(array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
435
+                if (array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
436 436
                     $return = $this->extractDataWithFormat();
437
-                } else {
437
+                }else {
438 438
                     $return = $this->list->toArray(null, false, $this->fieldType ?: TableMap::TYPE_PHPNAME, false);
439 439
                 }
440 440
                 $total = 0;
441 441
                 $pages = 0;
442
-                if($this->list instanceof PropelModelPager) {
442
+                if ($this->list instanceof PropelModelPager) {
443 443
                     $total = $this->list->getNbResults();
444 444
                     $pages = $this->list->getLastPage();
445
-                } elseif($this->list instanceof ArrayCollection) {
445
+                } elseif ($this->list instanceof ArrayCollection) {
446 446
                     $total = count($return);
447 447
                     $pages = 1;
448 448
                 }
449 449
             }
450
-        } catch (\Exception $e) {
451
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
450
+        }catch (\Exception $e) {
451
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
452 452
         }
453 453
 
454 454
         return array($return, $total, $pages);
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
         $return = array();
467 467
         if (NULL === $model || !method_exists($model, 'toArray')) {
468 468
             $code = 404;
469
-        } else {
469
+        }else {
470 470
             $return = $model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
471 471
         }
472 472
 
Please login to merge, or discard this patch.
src/base/types/helpers/I18nHelper.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         // TODO check more en locales
45 45
         if (strtolower($locale) === 'en') {
46 46
             $locale = 'en_GB';
47
-        } else {
48
-            $locale = $locale . '_' . strtoupper($locale);
47
+        }else {
48
+            $locale = $locale.'_'.strtoupper($locale);
49 49
         }
50 50
         $defaultLocales = explode(',', Config::getParam('i18n.locales', ''));
51 51
         if (!in_array($locale, array_merge($defaultLocales, self::$langs))) {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $translations = array();
65 65
         if (file_exists($absoluteFileName)) {
66 66
             @include($absoluteFileName);
67
-        } else {
67
+        }else {
68 68
             Cache::getInstance()->storeData($absoluteFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
69 69
         }
70 70
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
     public static function setLocale($default = null)
80 80
     {
81 81
         $locale = self::extractLocale($default);
82
-        Inspector::stats('[i18NHelper] Set locale to project [' . $locale . ']', Inspector::SCOPE_DEBUG);
82
+        Inspector::stats('[i18NHelper] Set locale to project ['.$locale.']', Inspector::SCOPE_DEBUG);
83 83
         // Load translations
84
-        putenv("LC_ALL=" . $locale);
84
+        putenv("LC_ALL=".$locale);
85 85
         setlocale(LC_ALL, $locale);
86 86
         // Load the locale path
87
-        $localePath = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
88
-        Logger::log('Set locale dir ' . $localePath);
87
+        $localePath = BASE_DIR.DIRECTORY_SEPARATOR.'locale';
88
+        Logger::log('Set locale dir '.$localePath);
89 89
         GeneratorHelper::createDir($localePath);
90 90
         bindtextdomain('translations', $localePath);
91 91
         textdomain('translations');
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             }
106 106
         } elseif (is_object($data)) {
107 107
             $properties = get_class_vars($data);
108
-            if(is_array($properties)) {
108
+            if (is_array($properties)) {
109 109
                 foreach (array_keys($properties) as $property) {
110 110
                     $data->$property = self::utf8Encode($data->$property);
111 111
                 }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             ['i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'],
153 153
             ['o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'],
154 154
             ['u', 'u', 'u', 'u', 'U', 'U', 'U', 'U'],
155
-            ['n', 'N', 'c', 'C',],
155
+            ['n', 'N', 'c', 'C', ],
156 156
         ];
157 157
 
158 158
         $text = filter_var($string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
@@ -172,24 +172,24 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public static function findTranslations($path, $locale)
174 174
     {
175
-        $localePath = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
176
-        $localePath .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
175
+        $localePath = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
176
+        $localePath .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
177 177
 
178 178
         $translations = array();
179 179
         if (file_exists($path)) {
180 180
             $directory = dir($path);
181 181
             while (false !== ($fileName = $directory->read())) {
182 182
                 GeneratorHelper::createDir($localePath);
183
-                if (!file_exists($localePath . 'translations.po')) {
184
-                    file_put_contents($localePath . 'translations.po', '');
183
+                if (!file_exists($localePath.'translations.po')) {
184
+                    file_put_contents($localePath.'translations.po', '');
185 185
                 }
186
-                $inspectPath = realpath($path . DIRECTORY_SEPARATOR . $fileName);
187
-                $cmdPhp = "export PATH=\$PATH:/opt/local/bin; xgettext " .
188
-                    $inspectPath . DIRECTORY_SEPARATOR .
186
+                $inspectPath = realpath($path.DIRECTORY_SEPARATOR.$fileName);
187
+                $cmdPhp = "export PATH=\$PATH:/opt/local/bin; xgettext ".
188
+                    $inspectPath.DIRECTORY_SEPARATOR.
189 189
                     "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$localePath}translations.po";
190
-                if (is_dir($path . DIRECTORY_SEPARATOR . $fileName) && preg_match('/^\./', $fileName) == 0) {
191
-                    $res = t('Revisando directorio: ') . $inspectPath;
192
-                    $res .= t('Comando ejecutado: ') . $cmdPhp;
190
+                if (is_dir($path.DIRECTORY_SEPARATOR.$fileName) && preg_match('/^\./', $fileName) == 0) {
191
+                    $res = t('Revisando directorio: ').$inspectPath;
192
+                    $res .= t('Comando ejecutado: ').$cmdPhp;
193 193
                     $res .= shell_exec($cmdPhp);
194 194
                     usleep(10);
195 195
                     $translations[] = $res;
Please login to merge, or discard this patch.
src/functions.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $html = '<style>*{margin: 0} body{background: rgb(36,36,36); padding: 5px;}</style>';
37 37
         $html .= '<pre style="padding: 10px; margin: 5px; display: block; background: rgb(41,41,41); color: white; border-radius: 5px;">';
38
-        if(is_null($var)) {
39
-            if($varName) $html .= $varName . ' ==> <b>NULL</b>';
40
-        } else {
41
-            $html .= print_r('(' . gettype($var) . ') ', TRUE);
42
-            if($varName) $html .= $varName . ' ==> ';
43
-            if("boolean" === gettype($var)) {
38
+        if (is_null($var)) {
39
+            if ($varName) $html .= $varName.' ==> <b>NULL</b>';
40
+        }else {
41
+            $html .= print_r('('.gettype($var).') ', TRUE);
42
+            if ($varName) $html .= $varName.' ==> ';
43
+            if ("boolean" === gettype($var)) {
44 44
                 $html .= print_r($var ? "TRUE" : "FALSE", TRUE);
45
-            } else if((is_array($var) && !empty($var)) || (!is_array($var)) ||  ($var === 0)) {
45
+            }else if ((is_array($var) && !empty($var)) || (!is_array($var)) || ($var === 0)) {
46 46
                 $html .= print_r($var, TRUE);
47
-            } else {
47
+            }else {
48 48
                 $html .= 'empty';
49 49
             }
50 50
         }
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
     /* @var $file SplFileInfo */
80 80
     foreach ($finder as $file) {
81 81
         $path = $file->getRealPath();
82
-        if(!in_array($path, $loaded_files)) {
82
+        if (!in_array($path, $loaded_files)) {
83 83
             $loaded_files[] = $path;
84 84
             require_once($path);
85 85
         }
86 86
     }
87 87
 }
88 88
 
89
-if(!function_exists('t')) {
89
+if (!function_exists('t')) {
90 90
     function t($message, $key = null, $reload = false) {
91 91
         return CustomTranslateExtension::_($message, $key, $reload);
92 92
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,10 +36,14 @@  discard block
 block discarded – undo
36 36
         $html = '<style>*{margin: 0} body{background: rgb(36,36,36); padding: 5px;}</style>';
37 37
         $html .= '<pre style="padding: 10px; margin: 5px; display: block; background: rgb(41,41,41); color: white; border-radius: 5px;">';
38 38
         if(is_null($var)) {
39
-            if($varName) $html .= $varName . ' ==> <b>NULL</b>';
39
+            if($varName) {
40
+                $html .= $varName . ' ==> <b>NULL</b>';
41
+            }
40 42
         } else {
41 43
             $html .= print_r('(' . gettype($var) . ') ', TRUE);
42
-            if($varName) $html .= $varName . ' ==> ';
44
+            if($varName) {
45
+                $html .= $varName . ' ==> ';
46
+            }
43 47
             if("boolean" === gettype($var)) {
44 48
                 $html .= print_r($var ? "TRUE" : "FALSE", TRUE);
45 49
             } else if((is_array($var) && !empty($var)) || (!is_array($var)) ||  ($var === 0)) {
@@ -63,9 +67,10 @@  discard block
 block discarded – undo
63 67
     function getallheaders()
64 68
     {
65 69
         $headers = [];
66
-        foreach ($_SERVER as $h => $v)
67
-            if (preg_match('/HTTP_(.+)/', $h, $hp)) {
70
+        foreach ($_SERVER as $h => $v) {
71
+                    if (preg_match('/HTTP_(.+)/', $h, $hp)) {
68 72
                 $headers[$hp[1]] = $v;
73
+        }
69 74
             }
70 75
         return $headers;
71 76
     }
Please login to merge, or discard this patch.
src/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
             $path = str_replace("\\", DIRECTORY_SEPARATOR, $class);
20 20
 
21 21
             // filepath
22
-            $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php";
22
+            $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php";
23 23
 
24 24
             // require the file
25 25
             if (file_exists($abs_path)) {
Please login to merge, or discard this patch.