Test Failed
Push — master ( 050678...48e4aa )
by Fran
27:11 queued 24:43
created
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);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '')
60 60
     {
61
-        $modulePath = $modPath . $module;
61
+        $modulePath = $modPath.$module;
62 62
         $this->generateControllerTemplate($module, $modulePath, $force, $controllerType);
63 63
         $this->generateServiceTemplate($module, $modulePath, $force);
64 64
         $this->generateSchemaTemplate($module, $modulePath, $force);
@@ -96,28 +96,28 @@  discard block
 block discarded – undo
96 96
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
97 97
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
98 98
             "class" => $class,
99
-            "controllerType" => $class . "Base",
99
+            "controllerType" => $class."Base",
100 100
             "is_base" => false
101 101
         ));
102
-        $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
103
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
102
+        $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
103
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
104 104
 
105 105
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
106 106
             "module" => $module,
107 107
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
108 108
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
109
-            "class" => $class . "Base",
109
+            "class" => $class."Base",
110 110
             "service" => $class,
111 111
             "controllerType" => $controllerType,
112 112
             "is_base" => true,
113 113
             "domain" => $class,
114 114
         ));
115
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
116
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
115
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
116
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
117 117
 
118
-        $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php";
118
+        $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php";
119 119
         $test = true;
120
-        if(!file_exists($filename)) {
120
+        if (!file_exists($filename)) {
121 121
             $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array(
122 122
                 "module" => $module,
123 123
                 "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function createModuleModels($module, $path)
138 138
     {
139
-        $modulePath = $path . $module;
140
-        $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $modulePath);
139
+        $modulePath = $path.$module;
140
+        $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $modulePath);
141 141
 
142 142
         $configGenerator = $this->getConfigGenerator($modulePath);
143 143
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
         $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
148 148
             "module" => $module,
149 149
         ));
150
-        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" .
151
-            DIRECTORY_SEPARATOR . "config.php", true);
150
+        $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config".
151
+            DIRECTORY_SEPARATOR."config.php", true);
152 152
         Logger::log("Generado config genérico para propel");
153 153
     }
154 154
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
     private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "")
164 164
     {
165 165
         $created = true;
166
-        $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models';
167
-        $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api';
166
+        $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models';
167
+        $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api';
168 168
         if (file_exists($modelPath)) {
169 169
             $dir = dir($modelPath);
170 170
             $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         //Generamos el fichero de configuración
183 183
         Logger::log("Generamos fichero vacío de configuración");
184 184
         return $this->writeTemplateToFile("<?php\n\t",
185
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
185
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
186 186
             $force);
187 187
     }
188 188
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             "db" => $this->config->get("db_name"),
204 204
         ));
205 205
         return $this->writeTemplateToFile($schema,
206
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
206
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
207 207
             $force);
208 208
     }
209 209
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
222 222
         ));
223 223
         return $this->writeTemplateToFile($buildProperties,
224
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php",
224
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php",
225 225
             $force);
226 226
     }
227 227
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             "module" => $module,
240 240
         ));
241 241
         return $this->writeTemplateToFile($index,
242
-            $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
242
+            $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
243 243
             $force);
244 244
     }
245 245
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         ));
270 270
 
271 271
         return $this->writeTemplateToFile($controller,
272
-            $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
272
+            $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
273 273
     }
274 274
 
275 275
     /**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             "package" => $package,
295 295
         ));
296 296
 
297
-        return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force);
297
+        return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force);
298 298
     }
299 299
 
300 300
     /**
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
         $base = $dir->path;
312 312
         while ($file = $dir->read()) {
313 313
             if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) {
314
-                if (is_dir($base . DIRECTORY_SEPARATOR . $file)) {
315
-                    $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file);
316
-                } else if (!preg_match('/Query\.php$/i', $file)
314
+                if (is_dir($base.DIRECTORY_SEPARATOR.$file)) {
315
+                    $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file);
316
+                }else if (!preg_match('/Query\.php$/i', $file)
317 317
                     && !preg_match('/I18n\.php$/i', $file)
318 318
                     && preg_match('/\.php$/i', $file)
319 319
                 ) {
320 320
                     $filename = str_replace(".php", "", $file);
321 321
                     $this->log->addLog("Generamos Api BASES para {$filename}");
322
-                    if($this->checkIfIsModel($module, $filename, $package)) {
322
+                    if ($this->checkIfIsModel($module, $filename, $package)) {
323 323
                         $this->createApiBaseFile($module, $apiPath, $filename, $apiClass, $package);
324 324
                         $this->createApi($module, $apiPath, $force, $filename, $package);
325 325
                     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             $parts[] = $package;
343 343
         }
344 344
         $parts[] = $filename;
345
-        $namespace = '\\' . implode('\\', $parts);
345
+        $namespace = '\\'.implode('\\', $parts);
346 346
         $reflectorClass = new \ReflectionClass($namespace);
347 347
         $isModel = $reflectorClass->isInstantiable();
348 348
         return $isModel;
Please login to merge, or discard this patch.