Passed
Push — master ( ce2bc1...e68e02 )
by Fran
05:34
created
src/base/types/helpers/DeployHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@
 block discarded – undo
24 24
         $now = new DateTime();
25 25
         $now->setTimezone(new DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid')));
26 26
         $config = Config::getInstance()->dumpConfig();
27
-        if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $config[self::CACHE_VAR_TAG] . '.file.cache')) {
28
-            unlink(CACHE_DIR . DIRECTORY_SEPARATOR . $config[self::CACHE_VAR_TAG] . '.file.cache');
27
+        if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$config[self::CACHE_VAR_TAG].'.file.cache')) {
28
+            unlink(CACHE_DIR.DIRECTORY_SEPARATOR.$config[self::CACHE_VAR_TAG].'.file.cache');
29 29
         }
30
-        $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His');
30
+        $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His');
31 31
         Config::save($config);
32 32
         return $config[self::CACHE_VAR_TAG];
33 33
     }
Please login to merge, or discard this patch.
src/base/types/helpers/InjectorHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                         'required' => $isRequired,
44 44
                         'description' => $label,
45 45
                     ];
46
-                } else {
46
+                }else {
47 47
                     $instance = new ReflectionClass($instanceType);
48 48
                     $variables[$property->getName()] = [
49 49
                         'is_array' => $isArray,
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public static function constructInjectableInstance($variable, $singleton, $classNameSpace, $calledClass)
161 161
     {
162
-        Logger::log('Create inyectable instance for ' . $classNameSpace);
162
+        Logger::log('Create inyectable instance for '.$classNameSpace);
163 163
         $reflector = new ReflectionClass($calledClass);
164 164
         $property = $reflector->getProperty($variable);
165 165
         $varInstanceType = (null === $classNameSpace) ? InjectorHelper::extractVarType($property->getDocComment()) : $classNameSpace;
166 166
         if (true === $singleton && method_exists($varInstanceType, 'getInstance')) {
167 167
             $instance = $varInstanceType::getInstance();
168
-        } else {
168
+        }else {
169 169
             $instance = new $varInstanceType();
170 170
         }
171 171
         return $instance;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     public static function getClassProperties($class)
180 180
     {
181 181
         $properties = [];
182
-        Logger::log('Extracting annotations properties from class ' . $class);
182
+        Logger::log('Extracting annotations properties from class '.$class);
183 183
         $selfReflector = new ReflectionClass($class);
184 184
         if (false !== $selfReflector->getParentClass()) {
185 185
             $properties = self::getClassProperties($selfReflector->getParentClass()->getName());
Please login to merge, or discard this patch.
src/base/types/helpers/Inspector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     {
53 53
         return [
54 54
             'ts' => round($stats['ts'] - $timestamp, 4),
55
-            'mem' => round(($stats['mem'] - $mem) / 1024 / 1024, 4),
55
+            'mem' => round(($stats['mem'] - $mem)/1024/1024, 4),
56 56
             'files' => $stats['files'] - $files,
57 57
             'name' => $stats['name'],
58 58
         ];
Please login to merge, or discard this patch.
src/base/types/helpers/AssetsHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,26 +66,26 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return string[]
68 68
      */
69
-    public static function calculateAssetPath(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): array
69
+    public static function calculateAssetPath(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): array
70 70
     {
71 71
         $path = explode("/", $string);
72 72
         $originalFilename = end($path);
73
-        $base = WEB_DIR . DIRECTORY_SEPARATOR;
73
+        $base = WEB_DIR.DIRECTORY_SEPARATOR;
74 74
         $debug = Config::getParam('debug');
75 75
         $cache = Config::getParam('cache.var');
76
-        $cache = $cache ? '.' . $cache : '';
76
+        $cache = $cache ? '.'.$cache : '';
77 77
         $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión
78 78
         $mime = finfo_file($finfo, $filenamePath);
79 79
         $extension = explode(".", $string);
80 80
         $extension = end($extension);
81
-        $file = "/" . substr(md5($string), 0, 8) . "." . $extension;
81
+        $file = "/".substr(md5($string), 0, 8).".".$extension;
82 82
         $htmlBase = '';
83 83
         finfo_close($finfo);
84 84
         if (preg_match('/\.css$/i', $string)) {
85
-            $file = "/" . substr(md5($string), 0, 8) . "$cache.css";
85
+            $file = "/".substr(md5($string), 0, 8)."$cache.css";
86 86
             $htmlBase = "css";
87 87
         } elseif (preg_match('/\.js$/i', $string)) {
88
-            $file = "/" . substr(md5($string), 0, 8) . "$cache.js";
88
+            $file = "/".substr(md5($string), 0, 8)."$cache.js";
89 89
             $htmlBase = "js";
90 90
         } elseif (preg_match("/image/i", $mime)) {
91 91
             $htmlBase = "img";
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
             $file = $name;
100 100
         }
101 101
         if ($debug) {
102
-            $file = str_replace("." . $extension, "_" . $originalFilename, $file);
102
+            $file = str_replace(".".$extension, "_".$originalFilename, $file);
103 103
         }
104
-        $filePath = $htmlBase . $file;
104
+        $filePath = $htmlBase.$file;
105 105
 
106 106
         return array($base, $htmlBase, $filePath);
107 107
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         GeneratorHelper::createDir(dirname($path));
118 118
         if ("" !== $content && false === file_put_contents($path, $content)) {
119
-            throw new ConfigException(t('No se tienen permisos para escribir en ' . $path));
119
+            throw new ConfigException(t('No se tienen permisos para escribir en '.$path));
120 120
         }
121 121
     }
122 122
 }
Please login to merge, or discard this patch.
src/controller/GeneratorController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function generateModule()
36 36
     {
37
-        Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri());
37
+        Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri());
38 38
         /* @var $form ConfigForm */
39 39
         $form = new ModuleForm();
40 40
         $form->build();
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
                 $this->gen->createStructureModule($module, false, $type, $apiClass);
66 66
                 Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente")));
67 67
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
68
-            } catch (Exception $e) {
69
-                Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
68
+            }catch (Exception $e) {
69
+                Logger::log($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
70 70
                 Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage()));
71 71
             }
72 72
         }
Please login to merge, or discard this patch.
src/controller/I18nController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         //Generating the templates translations
45 45
         $translations = $this->tpl->regenerateTemplates();
46 46
 
47
-        $localePath = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
48
-        $localePath .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
47
+        $localePath = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
48
+        $localePath .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
49 49
 
50 50
         //xgettext localizations
51 51
         $translations = array_merge($translations, I18nHelper::findTranslations(SOURCE_DIR, $locale));
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $translations = array_merge($translations, I18nHelper::findTranslations(CACHE_DIR, $locale));
54 54
 
55 55
         $translations[] = "msgfmt {$localePath}translations.po -o {$localePath}translations.mo";
56
-        $translations[] = shell_exec('export PATH=\$PATH:/opt/local/bin:/bin:/sbin; msgfmt ' . $localePath . 'translations.po -o ' . $localePath . 'translations.mo');
56
+        $translations[] = shell_exec('export PATH=\$PATH:/opt/local/bin:/bin:/sbin; msgfmt '.$localePath.'translations.po -o '.$localePath.'translations.mo');
57 57
         return $this->render('translations.html.twig', array(
58 58
             'translations' => $translations,
59 59
         ));
Please login to merge, or discard this patch.
src/services/MigrationService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function getConnectionManager(string $module, string $path): array
26 26
     {
27
-        $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $path . $module);
27
+        $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $path.$module);
28 28
         $generatorConfig = $this->getConfigGenerator($modulePath);
29 29
 
30 30
         $manager = new MigrationManager();
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $migrationFileName = $manager->getMigrationFileName($timestamp);
116 116
         $migrationClassBody = $manager->getMigrationClassBody($migrationsUp, $migrationsDown, $timestamp);
117 117
 
118
-        $file = $generatorConfig->getSection('paths')['migrationDir'] . DIRECTORY_SEPARATOR . $migrationFileName;
118
+        $file = $generatorConfig->getSection('paths')['migrationDir'].DIRECTORY_SEPARATOR.$migrationFileName;
119 119
         file_put_contents($file, $migrationClassBody);
120 120
 
121 121
         Logger::log(sprintf('"%s" file successfully created.', $file));
Please login to merge, or discard this patch.
src/services/GeneratorService.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function createStructureModule(string $module, bool $force = false, string $type = "", string $apiClass = "", bool $skipMigration = false): void
51 51
     {
52
-        $modPath = CORE_DIR . DIRECTORY_SEPARATOR;
52
+        $modPath = CORE_DIR.DIRECTORY_SEPARATOR;
53 53
         $module = ucfirst($module);
54 54
         $this->createModulePath($module, $modPath);
55 55
         $this->createModulePathTree($module, $modPath);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '')
75 75
     {
76
-        $modulePath = $modPath . $module;
76
+        $modulePath = $modPath.$module;
77 77
         $this->generateControllerTemplate($module, $modulePath, $force, $controllerType);
78 78
         $this->generateServiceTemplate($module, $modulePath, $force);
79 79
         $this->generateSchemaTemplate($module, $modulePath, $force);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->genereateAutoloaderTemplate($module, $modulePath, $force);
95 95
         $this->generatePropertiesTemplate($module, $modulePath, $force);
96 96
         $this->generateConfigTemplate($modulePath, $force);
97
-        $this->createModuleModels($module, CORE_DIR . DIRECTORY_SEPARATOR);
97
+        $this->createModuleModels($module, CORE_DIR.DIRECTORY_SEPARATOR);
98 98
     }
99 99
 
100 100
     /**
@@ -114,26 +114,26 @@  discard block
 block discarded – undo
114 114
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
115 115
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
116 116
             "class" => $class,
117
-            "controllerType" => $class . "Base",
117
+            "controllerType" => $class."Base",
118 118
             "is_base" => false
119 119
         ));
120
-        $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
121
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
120
+        $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
121
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
122 122
 
123 123
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
124 124
             "module" => $module,
125 125
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
126 126
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
127
-            "class" => $class . "Base",
127
+            "class" => $class."Base",
128 128
             "service" => $class,
129 129
             "controllerType" => $controllerType,
130 130
             "is_base" => true,
131 131
             "domain" => $class,
132 132
         ));
133
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
134
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
133
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
134
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
135 135
 
136
-        $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php";
136
+        $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php";
137 137
         $test = true;
138 138
         if (!file_exists($filename)) {
139 139
             $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array(
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     private function createModuleModels($module, $path)
156 156
     {
157
-        $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $path . $module);
157
+        $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $path.$module);
158 158
         $configGenerator = $this->getConfigGenerator($modulePath);
159 159
 
160 160
         $this->buildModels($configGenerator);
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
         $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
164 164
             "module" => $module,
165 165
         ));
166
-        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" .
167
-            DIRECTORY_SEPARATOR . "config.php", true);
166
+        $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config".
167
+            DIRECTORY_SEPARATOR."config.php", true);
168 168
         Logger::log("Generado config genérico para propel");
169 169
     }
170 170
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
         if ($totalNbTables) {
201 201
             Logger::log(sprintf('%d tables found in all databases.', $totalNbTables));
202
-        } else {
202
+        }else {
203 203
             Logger::log('No table found in all databases');
204 204
         }
205 205
 
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
     private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "")
257 257
     {
258 258
         $created = true;
259
-        $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models';
260
-        $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api';
259
+        $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models';
260
+        $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api';
261 261
         if (file_exists($modelPath)) {
262 262
             $dir = dir($modelPath);
263 263
             $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         //Generamos el fichero de configuración
276 276
         Logger::log("Generamos fichero vacío de configuración");
277 277
         return $this->writeTemplateToFile("<?php\n\t",
278
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
278
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
279 279
             $force);
280 280
     }
281 281
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             "db" => $this->config->get("db_name"),
297 297
         ));
298 298
         return $this->writeTemplateToFile($schema,
299
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
299
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
300 300
             $force);
301 301
     }
302 302
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
315 315
         ));
316 316
         return $this->writeTemplateToFile($buildProperties,
317
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php",
317
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php",
318 318
             $force);
319 319
     }
320 320
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             "module" => $module,
333 333
         ));
334 334
         return $this->writeTemplateToFile($index,
335
-            $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
335
+            $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
336 336
             $force);
337 337
     }
338 338
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         ));
363 363
 
364 364
         return $this->writeTemplateToFile($controller,
365
-            $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
365
+            $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
366 366
     }
367 367
 
368 368
     /**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             "package" => $package,
388 388
         ));
389 389
 
390
-        return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force);
390
+        return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force);
391 391
     }
392 392
 
393 393
     /**
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
         $base = $dir->path;
405 405
         while ($file = $dir->read()) {
406 406
             if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) {
407
-                if (is_dir($base . DIRECTORY_SEPARATOR . $file)) {
408
-                    $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file);
409
-                } else if (!preg_match('/Query\.php$/i', $file)
407
+                if (is_dir($base.DIRECTORY_SEPARATOR.$file)) {
408
+                    $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file);
409
+                }else if (!preg_match('/Query\.php$/i', $file)
410 410
                     && !preg_match('/I18n\.php$/i', $file)
411 411
                     && preg_match('/\.php$/i', $file)
412 412
                 ) {
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             $parts[] = $package;
436 436
         }
437 437
         $parts[] = $filename;
438
-        $namespace = '\\' . implode('\\', $parts);
438
+        $namespace = '\\'.implode('\\', $parts);
439 439
         $reflectorClass = new \ReflectionClass($namespace);
440 440
         $isModel = $reflectorClass->isInstantiable();
441 441
         return $isModel;
Please login to merge, or discard this patch.
src/base/types/Controller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $vars['__profiling__'] = Inspector::getStats();
43 43
         }
44 44
         $domain = (null === $domain) ? $this->getDomain() : $domain;
45
-        return $this->tpl->render($domain . $template, $vars, $cookies);
45
+        return $this->tpl->render($domain.$template, $vars, $cookies);
46 46
     }
47 47
 
48 48
     /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $vars['__menu__'] = $this->getMenu();
75 75
         $domain = $domain ?: $this->getDomain();
76
-        return $this->tpl->dump($domain . $template, $vars);
76
+        return $this->tpl->dump($domain.$template, $vars);
77 77
     }
78 78
 
79 79
     /**
Please login to merge, or discard this patch.