Test Failed
Push — master ( 1b7368...050678 )
by Fran
25:16 queued 22:49
created
src/base/types/traits/Helper/ServerTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public function getServer($key, $default = null)
22 22
     {
23 23
         $value = null;
24
-        if(array_key_exists($key, $this->server)) {
24
+        if (array_key_exists($key, $this->server)) {
25 25
             $value = $this->server[$key];
26 26
         }
27 27
         return $value ?: $default;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function getProtocol()
62 62
     {
63
-        if(Config::getParam('force.https', false)) {
63
+        if (Config::getParam('force.https', false)) {
64 64
             return 'https://';
65 65
         }
66 66
         return ($this->getServer('HTTPS') || $this->getServer('https')) ? 'https://' : 'http://';
Please login to merge, or discard this patch.
src/services/AdminServices.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $platform = trim(Config::getInstance()->get('platform.name', 'PSFS'));
36 36
         header('HTTP/1.1 401 Unauthorized');
37
-        header('WWW-Authenticate: Basic Realm="' . $platform . '"');
37
+        header('WWW-Authenticate: Basic Realm="'.$platform.'"');
38 38
         echo t('Zona restringida');
39 39
         exit();
40 40
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                             $admin['class'] = 'primary';
77 77
                             break;
78 78
                     }
79
-                } else {
79
+                }else {
80 80
                     $admin['class'] = 'primary';
81 81
                 }
82 82
             }
Please login to merge, or discard this patch.
src/services/GeneratorService.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function createStructureModule($module, $force = false, $type = "", $apiClass = "")
40 40
     {
41
-        $modPath = CORE_DIR . DIRECTORY_SEPARATOR;
41
+        $modPath = CORE_DIR.DIRECTORY_SEPARATOR;
42 42
         $module = ucfirst($module);
43 43
         $this->createModulePath($module, $modPath);
44 44
         $this->createModulePathTree($module, $modPath);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '')
61 61
     {
62
-        $modulePath = $modPath . $module;
62
+        $modulePath = $modPath.$module;
63 63
         $this->generateControllerTemplate($module, $modulePath, $force, $controllerType);
64 64
         $this->generateServiceTemplate($module, $modulePath, $force);
65 65
         $this->genereateAutoloaderTemplate($module, $modulePath, $force);
@@ -87,28 +87,28 @@  discard block
 block discarded – undo
87 87
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
88 88
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
89 89
             "class" => $class,
90
-            "controllerType" => $class . "Base",
90
+            "controllerType" => $class."Base",
91 91
             "is_base" => false
92 92
         ));
93
-        $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
94
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
93
+        $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
94
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
95 95
 
96 96
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
97 97
             "module" => $module,
98 98
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
99 99
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
100
-            "class" => $class . "Base",
100
+            "class" => $class."Base",
101 101
             "service" => $class,
102 102
             "controllerType" => $controllerType,
103 103
             "is_base" => true,
104 104
             "domain" => $class,
105 105
         ));
106
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
107
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
106
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
107
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
108 108
 
109
-        $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php";
109
+        $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php";
110 110
         $test = true;
111
-        if(!file_exists($filename)) {
111
+        if (!file_exists($filename)) {
112 112
             $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array(
113 113
                 "module" => $module,
114 114
                 "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
      */
128 128
     private function createModuleModels($module, $path)
129 129
     {
130
-        $modulePath = $path . $module;
131
-        $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $modulePath);
130
+        $modulePath = $path.$module;
131
+        $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $modulePath);
132 132
 
133 133
         $configGenerator = $this->getConfigGenerator($modulePath);
134 134
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
         $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
139 139
             "module" => $module,
140 140
         ));
141
-        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" .
142
-            DIRECTORY_SEPARATOR . "config.php", true);
141
+        $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config".
142
+            DIRECTORY_SEPARATOR."config.php", true);
143 143
         Logger::log("Generado config genérico para propel");
144 144
     }
145 145
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
     private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "")
155 155
     {
156 156
         $created = true;
157
-        $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models';
158
-        $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api';
157
+        $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models';
158
+        $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api';
159 159
         if (file_exists($modelPath)) {
160 160
             $dir = dir($modelPath);
161 161
             $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         //Generamos el fichero de configuración
174 174
         Logger::log("Generamos fichero vacío de configuración");
175 175
         return $this->writeTemplateToFile("<?php\n\t",
176
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
176
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
177 177
             $force);
178 178
     }
179 179
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             "db" => $this->config->get("db_name"),
195 195
         ));
196 196
         return $this->writeTemplateToFile($schema,
197
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
197
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
198 198
             $force);
199 199
     }
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
213 213
         ));
214 214
         return $this->writeTemplateToFile($buildProperties,
215
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php",
215
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php",
216 216
             $force);
217 217
     }
218 218
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             "module" => $module,
231 231
         ));
232 232
         return $this->writeTemplateToFile($index,
233
-            $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
233
+            $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
234 234
             $force);
235 235
     }
236 236
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         ));
261 261
 
262 262
         return $this->writeTemplateToFile($controller,
263
-            $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
263
+            $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
264 264
     }
265 265
 
266 266
     /**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             "package" => $package,
286 286
         ));
287 287
 
288
-        return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force);
288
+        return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force);
289 289
     }
290 290
 
291 291
     /**
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
         $base = $dir->path;
303 303
         while ($file = $dir->read()) {
304 304
             if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) {
305
-                if (is_dir($base . DIRECTORY_SEPARATOR . $file)) {
306
-                    $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file);
307
-                } else if (!preg_match('/Query\.php$/i', $file)
305
+                if (is_dir($base.DIRECTORY_SEPARATOR.$file)) {
306
+                    $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file);
307
+                }else if (!preg_match('/Query\.php$/i', $file)
308 308
                     && !preg_match('/I18n\.php$/i', $file)
309 309
                     && preg_match('/\.php$/i', $file)
310 310
                 ) {
311 311
                     $filename = str_replace(".php", "", $file);
312 312
                     $this->log->addLog("Generamos Api BASES para {$filename}");
313
-                    if($this->checkIfIsModel($module, $filename, $package)) {
313
+                    if ($this->checkIfIsModel($module, $filename, $package)) {
314 314
                         $this->createApiBaseFile($module, $apiPath, $filename, $apiClass, $package);
315 315
                         $this->createApi($module, $apiPath, $force, $filename, $package);
316 316
                     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             $parts[] = $package;
334 334
         }
335 335
         $parts[] = $filename;
336
-        $namespace = '\\' . implode('\\', $parts);
336
+        $namespace = '\\'.implode('\\', $parts);
337 337
         $reflectorClass = new \ReflectionClass($namespace);
338 338
         $isModel = $reflectorClass->isInstantiable();
339 339
         return $isModel;
Please login to merge, or discard this patch.
src/base/types/CurlService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $headers = [];
90 90
         foreach ($this->getHeaders() as $key => $value) {
91
-            $headers[] = $key . ': ' . $value;
91
+            $headers[] = $key.': '.$value;
92 92
         }
93 93
         $headers[self::PSFS_TRACK_HEADER] = Logger::getUid();
94 94
         if (count($headers)) {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             case Request::VERB_GET:
119 119
                 if (!empty($this->params)) {
120 120
                     $sep = !str_contains($this->getUrl(), '?') ? '?' : '';
121
-                    $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false);
121
+                    $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false);
122 122
                 }
123 123
                 break;
124 124
             case Request::VERB_POST:
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         if ($this->isDebug() && is_resource($verbose)) {
150 150
             $this->dumpVerboseLogs($verbose);
151 151
         }
152
-        Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]);
152
+        Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]);
153 153
         $this->info = array_merge($this->info, curl_getinfo($this->con));
154 154
     }
155 155
 
Please login to merge, or discard this patch.
src/base/types/helpers/SecurityHelper.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false))
35 35
         ) {
36 36
             if (!self::isTest() &&
37
-                null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) {
37
+                null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) {
38 38
                 throw new AdminCredentialsException();
39 39
             }
40 40
             if (!Security::getInstance()->checkAdmin()) {
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $token = '';
55 55
         $length = strlen($timestamp);
56 56
         for ($i = 0; $i < $length; $i++) {
57
-            $token = substr($hash, $i, 1) .
58
-                substr($timestamp, $i, 1) .
57
+            $token = substr($hash, $i, 1).
58
+                substr($timestamp, $i, 1).
59 59
                 $token;
60 60
         }
61 61
         return $token;
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
         $charsLength = strlen(self::RAND_SEP) - 1;
75 75
         $tsLength = strlen($timestamp);
76 76
         $i = 0;
77
-        $partCount = ceil($hashRest / 4);
78
-        $part = substr($hash, $tsLength + $partCount * $i, $partCount);
77
+        $partCount = ceil($hashRest/4);
78
+        $part = substr($hash, $tsLength + $partCount*$i, $partCount);
79 79
         while (false !== $part && strlen($part) > 0) {
80
-            $mixedToken .= $part .
81
-                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) .
80
+            $mixedToken .= $part.
81
+                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1).
82 82
                 substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1);
83
-            $part = substr($hash, $tsLength + $partCount * $i, $partCount);
83
+            $part = substr($hash, $tsLength + $partCount*$i, $partCount);
84 84
             $i++;
85 85
         }
86
-        return $mixedToken . $token;
86
+        return $mixedToken.$token;
87 87
     }
88 88
 
89 89
     /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     private static function getTs($isOdd = null)
94 94
     {
95 95
         $timestamp = time();
96
-        $tsIsOdd = (bool)((int)substr($timestamp, -1) % 2);
96
+        $tsIsOdd = (bool)((int)substr($timestamp, -1)%2);
97 97
         if (false === $isOdd && !$tsIsOdd) {
98 98
             $timestamp--;
99 99
         } elseif (true === $isOdd && !$tsIsOdd) {
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
         $timestamp = '';
130 130
         $part = strrev($part);
131 131
         for ($i = 0, $ct = strlen($part); $i < $ct; $i++) {
132
-            if ($i % 2 == 0) {
132
+            if ($i%2 == 0) {
133 133
                 $timestamp .= substr($part, $i, 1);
134
-            } else {
134
+            }else {
135 135
                 $partToken .= substr($part, $i, 1);
136 136
             }
137 137
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         list($partToken, $timestamp) = self::extractTs(array_pop($parts));
149 149
         $token = null;
150 150
         if ($timestamp > 0) {
151
-            $token = $partToken . implode('', $parts);
151
+            $token = $partToken.implode('', $parts);
152 152
         }
153 153
         return [$token, $timestamp];
154 154
     }
Please login to merge, or discard this patch.
src/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +39 added lines, -39 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
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
             'crossdomain' => 'crossdomain.xml',
138 138
             'humans' => 'humans.txt',
139 139
             'robots' => 'robots.txt',
140
-            'docker' => '..' . DIRECTORY_SEPARATOR . 'docker-compose.yml',
140
+            'docker' => '..'.DIRECTORY_SEPARATOR.'docker-compose.yml',
141 141
         ];
142 142
         $output->writeln('Start creating html files');
143 143
         foreach ($files as $templates => $filename) {
144
-            $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig');
145
-            if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) {
146
-                if(!$quiet) {
147
-                    $output->writeln('Can\t create the file ' . $filename);
144
+            $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig');
145
+            if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) {
146
+                if (!$quiet) {
147
+                    $output->writeln('Can\t create the file '.$filename);
148 148
                 }
149
-            } else {
150
-                if(!$quiet) {
151
-                    $output->writeln($filename . ' created successfully');
149
+            }else {
150
+                if (!$quiet) {
151
+                    $output->writeln($filename.' created successfully');
152 152
                 }
153 153
             }
154 154
         }
155 155
 
156 156
         //Export base locale translations
157
-        if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) {
158
-            GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
159
-            self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
157
+        if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) {
158
+            GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
159
+            self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
160 160
         }
161 161
     }
162 162
 
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
     {
173 173
         if (file_exists($filenamePath)) {
174 174
             $destfolder = basename($filenamePath);
175
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
175
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
176 176
                 if (is_dir($filenamePath)) {
177
-                    self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
178
-                } else {
179
-                    if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
180
-                        throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
177
+                    self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
178
+                }else {
179
+                    if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
180
+                        throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
181 181
                     }
182 182
                 }
183 183
             }
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
         self::createDir($dst);
196 196
         while (false !== ($file = readdir($dir))) {
197 197
             if (($file != '.') && ($file != '..')) {
198
-                if (is_dir($src . '/' . $file)) {
199
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
200
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
201
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
198
+                if (is_dir($src.'/'.$file)) {
199
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
200
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
201
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
202 202
                 }
203 203
             }
204 204
         }
Please login to merge, or discard this patch.
src/base/types/helpers/RouterHelper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         Inspector::stats('[RouterHelper] Getting class to call for executing the request action', Inspector::SCOPE_DEBUG);
26 26
         Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action);
27
-        $actionClass = class_exists($action['class']) ? $action['class'] : "\\" . $action['class'];
27
+        $actionClass = class_exists($action['class']) ? $action['class'] : "\\".$action['class'];
28 28
         $reflectionClass = new ReflectionClass($actionClass);
29 29
         if ($reflectionClass->hasMethod('getInstance')) {
30 30
             $class = $reflectionClass->getMethod('getInstance')->invoke(null, $action['method']);
31
-        } else {
31
+        }else {
32 32
             $class = new $actionClass;
33 33
         }
34 34
         return $class;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public static function extractComponents($route, $pattern)
63 63
     {
64 64
         Inspector::stats('[RouterHelper] Extracting parts for the request to execute', Inspector::SCOPE_DEBUG);
65
-        if(Config::getParam('allow.double.slashes', true)) {
65
+        if (Config::getParam('allow.double.slashes', true)) {
66 66
             $route = preg_replace("/\/\//", '/', $route);
67 67
         }
68 68
         $url = parse_url($route);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $cleanPatternSep--;
101 101
         }
102 102
 
103
-        if(Config::getParam('allow.double.slashes', true)) {
103
+        if (Config::getParam('allow.double.slashes', true)) {
104 104
             $path = preg_replace("/\/\//", '/', $path);
105 105
         }
106 106
         $pathSep = count(explode('/', $path));
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public static function matchRoutePattern($routePattern, $path)
122 122
     {
123
-        if(Config::getParam('allow.double.slashes', true)) {
123
+        if (Config::getParam('allow.double.slashes', true)) {
124 124
             $path = preg_replace("/\/\//", '/', $path);
125 125
         }
126 126
         $expr = preg_replace('/\{([^}]+)\}/', '%%%', $routePattern);
127 127
         $expr = preg_quote($expr, '/');
128 128
         $expr = str_replace('%%%', '(.*)', $expr);
129 129
         $expr2 = preg_replace('/\(\.\*\)$/', '', $expr);
130
-        $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path);
130
+        $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path);
131 131
         return $matched;
132 132
     }
133 133
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public static function extractDomainInfo(ReflectionClass $class, $domain)
140 140
     {
141
-        $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
141
+        $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
142 142
         $templatesPath = 'templates';
143 143
         $publicPath = 'public';
144 144
         $modelsPath = 'models';
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
             $modelsPath = ucfirst($modelsPath);
149 149
         }
150 150
         if ($class->hasConstant('TPL')) {
151
-            $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL');
151
+            $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL');
152 152
         }
153 153
         return [
154 154
             'base' => $path,
155
-            'template' => $path . $templatesPath,
156
-            'model' => $path . $modelsPath,
157
-            'public' => $path . $publicPath,
155
+            'template' => $path.$templatesPath,
156
+            'model' => $path.$modelsPath,
157
+            'public' => $path.$publicPath,
158 158
         ];
159 159
     }
160 160
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
             foreach ($parameters as $param) {
176 176
                 if ($param->isOptional() && !is_array($param->getDefaultValue())) {
177 177
                     $params[$param->getName()] = $param->getDefaultValue();
178
-                    $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue() ?: '', $regex ?: '');
178
+                    $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue() ?: '', $regex ?: '');
179 179
                 } elseif (!$param->isOptional()) {
180 180
                     $requirements[] = $param->getName();
181 181
                 }
182 182
             }
183
-        } else {
183
+        }else {
184 184
             $default = $regex;
185 185
         }
186 186
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             $httpMethod = AnnotationHelper::extractReflectionHttpMethod($docComments);
211 211
             $icon = AnnotationHelper::extractDocIcon($docComments);
212 212
             $label = AnnotationHelper::extractReflectionLabel(str_replace('{__API__}', $api, $docComments));
213
-            $route = $httpMethod . "#|#" . $regex;
213
+            $route = $httpMethod."#|#".$regex;
214 214
             $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route);
215 215
             $info = [
216 216
                 'method' => $method->getName(),
Please login to merge, or discard this patch.
src/base/types/traits/Generator/PropelHelperTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
      */
23 23
     private function getPropelPaths($modulePath)
24 24
     {
25
-        $moduleDir = CORE_DIR . DIRECTORY_SEPARATOR . $modulePath;
25
+        $moduleDir = CORE_DIR.DIRECTORY_SEPARATOR.$modulePath;
26 26
         GeneratorHelper::createDir($moduleDir);
27 27
         $moduleDir = realpath($moduleDir);
28
-        $configDir = $moduleDir . DIRECTORY_SEPARATOR . 'Config';
29
-        $sqlDir = $moduleDir . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'Sql';
30
-        $migrationDir = $moduleDir . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'Migrations';
28
+        $configDir = $moduleDir.DIRECTORY_SEPARATOR.'Config';
29
+        $sqlDir = $moduleDir.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'Sql';
30
+        $migrationDir = $moduleDir.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'Migrations';
31 31
         $paths = [
32 32
             'projectDir' => $moduleDir,
33 33
             'outputDir' => $moduleDir,
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
      * @param AbstractManager $manager
91 91
      * @param string $workingDir
92 92
      */
93
-    private function setupManager(GeneratorConfig $configGenerator, AbstractManager &$manager, $workingDir = CORE_DIR)
93
+    private function setupManager(GeneratorConfig $configGenerator, AbstractManager & $manager, $workingDir = CORE_DIR)
94 94
     {
95 95
         $manager->setGeneratorConfig($configGenerator);
96
-        $schemaFile = new \SplFileInfo($configGenerator->getSection('paths')['schemaDir'] . DIRECTORY_SEPARATOR . 'schema.xml');
96
+        $schemaFile = new \SplFileInfo($configGenerator->getSection('paths')['schemaDir'].DIRECTORY_SEPARATOR.'schema.xml');
97 97
         $manager->setSchemas([$schemaFile]);
98
-        $manager->setLoggerClosure(function ($message) {
98
+        $manager->setLoggerClosure(function($message) {
99 99
             Logger::log($message, LOG_INFO);
100 100
         });
101 101
         $manager->setWorkingDirectory($workingDir);
Please login to merge, or discard this patch.
src/base/types/traits/CurlTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
     protected $isMultipart = false;
78 78
 
79 79
     protected function closeConnection(): void {
80
-        if(null !== $this?->con) {
81
-            if($this?->con instanceof \CurlHandle) {
80
+        if (null !== $this?->con) {
81
+            if ($this?->con instanceof \CurlHandle) {
82 82
                 curl_close($this->con);
83 83
             }
84 84
             $this->setCon(null);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $this->params = [];
96 96
         $this->headers = [];
97
-        Logger::log('Context service for ' . static::class . ' cleared!');
97
+        Logger::log('Context service for '.static::class.' cleared!');
98 98
         $this->closeConnection();
99 99
     }
100 100
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $this->clearContext();
104 104
         $con = curl_init($this->url);
105
-        if($con instanceof \CurlHandle) {
105
+        if ($con instanceof \CurlHandle) {
106 106
             $this->setCon($con);
107 107
         }
108 108
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public function setUrl(string $url, bool $cleanContext = true): void
123 123
     {
124 124
         $this->url = $url;
125
-        if($cleanContext) {
125
+        if ($cleanContext) {
126 126
             $this->initialize();
127 127
         }
128 128
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function setIsJson($isJson = true) {
189 189
         $this->isJson = $isJson;
190
-        if($isJson) {
190
+        if ($isJson) {
191 191
             $this->setIsMultipart(false);
192 192
         }
193 193
     }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function setIsMultipart($isMultipart = true) {
206 206
         $this->isMultipart = $isMultipart;
207
-        if($isMultipart) {
207
+        if ($isMultipart) {
208 208
             $this->setIsJson(false);
209 209
         }
210 210
     }
Please login to merge, or discard this patch.