@@ -4,19 +4,39 @@ |
||
| 4 | 4 | defined('PSFS_START_MEM') or define('PSFS_START_MEM', memory_get_usage()); |
| 5 | 5 | defined('PSFS_START_TS') or define('PSFS_START_TS', microtime(true)); |
| 6 | 6 | |
| 7 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
| 7 | +if (!defined('SOURCE_DIR')) { |
|
| 8 | + define('SOURCE_DIR', __DIR__); |
|
| 9 | +} |
|
| 8 | 10 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 9 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 10 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 11 | -} else { |
|
| 12 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 13 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 11 | + if (!defined('BASE_DIR')) { |
|
| 12 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 13 | + } |
|
| 14 | + if (!defined('CORE_DIR')) { |
|
| 15 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 16 | + } |
|
| 17 | + } else { |
|
| 18 | + if (!defined('BASE_DIR')) { |
|
| 19 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 20 | + } |
|
| 21 | + if (!defined('CORE_DIR')) { |
|
| 22 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | +if (!defined('VENDOR_DIR')) { |
|
| 26 | + define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 27 | +} |
|
| 28 | +if (!defined('LOG_DIR')) { |
|
| 29 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 30 | +} |
|
| 31 | +if (!defined('CACHE_DIR')) { |
|
| 32 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 33 | +} |
|
| 34 | +if (!defined('CONFIG_DIR')) { |
|
| 35 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 36 | +} |
|
| 37 | +if (!defined('WEB_DIR')) { |
|
| 38 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 14 | 39 | } |
| 15 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 16 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 17 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 18 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 19 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 20 | 40 | |
| 21 | 41 | |
| 22 | 42 | /** |
@@ -33,24 +33,24 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function findTranslations($path, $locale) |
| 35 | 35 | { |
| 36 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 37 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
| 36 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 37 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
| 38 | 38 | |
| 39 | 39 | $translations = array(); |
| 40 | 40 | if (file_exists($path)) { |
| 41 | 41 | $d = dir($path); |
| 42 | 42 | while (false !== ($dir = $d->read())) { |
| 43 | 43 | GeneratorHelper::createDir($locale_path); |
| 44 | - if (!file_exists($locale_path . 'translations.po')) { |
|
| 45 | - file_put_contents($locale_path . 'translations.po', ''); |
|
| 44 | + if (!file_exists($locale_path.'translations.po')) { |
|
| 45 | + file_put_contents($locale_path.'translations.po', ''); |
|
| 46 | 46 | } |
| 47 | - $inspect_path = realpath($path . DIRECTORY_SEPARATOR . $dir); |
|
| 48 | - $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext " . |
|
| 49 | - $inspect_path . DIRECTORY_SEPARATOR . |
|
| 47 | + $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir); |
|
| 48 | + $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ". |
|
| 49 | + $inspect_path.DIRECTORY_SEPARATOR. |
|
| 50 | 50 | "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
| 51 | - if (is_dir($path . DIRECTORY_SEPARATOR . $dir) && preg_match('/^\./', $dir) == 0) { |
|
| 52 | - $res = _('Revisando directorio: ') . $inspect_path; |
|
| 53 | - $res .= _('Comando ejecutado: ') . $cmd_php; |
|
| 51 | + if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) { |
|
| 52 | + $res = _('Revisando directorio: ').$inspect_path; |
|
| 53 | + $res .= _('Comando ejecutado: ').$cmd_php; |
|
| 54 | 54 | $res .= shell_exec($cmd_php); |
| 55 | 55 | usleep(10); |
| 56 | 56 | $translations[] = $res; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function createStructureModule($module, $force = false, $type = "", $apiClass = "") |
| 73 | 73 | { |
| 74 | - $mod_path = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 74 | + $mod_path = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 75 | 75 | $module = ucfirst($module); |
| 76 | 76 | $this->createModulePath($module, $mod_path); |
| 77 | 77 | $this->createModulePathTree($module, $mod_path); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // Creates the src folder |
| 93 | 93 | GeneratorHelper::createDir($mod_path); |
| 94 | 94 | // Create module path |
| 95 | - GeneratorHelper::createDir($mod_path . $module); |
|
| 95 | + GeneratorHelper::createDir($mod_path.$module); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | $this->log->infoLog("Generamos la estructura"); |
| 108 | 108 | $paths = [ |
| 109 | 109 | "Api", "Api/base", "Config", "Controller", "Models", "Public", "Templates", "Services", "Test", "Doc", |
| 110 | - "Locale", "Locale/" . Config::getParam('default.locale', 'es_ES'), "Locale/" . Config::getParam('default.locale', 'es_ES') . "/LC_MESSAGES" |
|
| 110 | + "Locale", "Locale/".Config::getParam('default.locale', 'es_ES'), "Locale/".Config::getParam('default.locale', 'es_ES')."/LC_MESSAGES" |
|
| 111 | 111 | ]; |
| 112 | - $module_path = $mod_path . $module; |
|
| 112 | + $module_path = $mod_path.$module; |
|
| 113 | 113 | foreach ($paths as $path) { |
| 114 | - GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . $path); |
|
| 114 | + GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR.$path); |
|
| 115 | 115 | } |
| 116 | 116 | //Creamos las carpetas de los assets |
| 117 | 117 | $htmlPaths = array("css", "js", "img", "media", "font"); |
| 118 | 118 | foreach ($htmlPaths as $path) { |
| 119 | - GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path); |
|
| 119 | + GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '') |
| 131 | 131 | { |
| 132 | - $module_path = $mod_path . $module; |
|
| 132 | + $module_path = $mod_path.$module; |
|
| 133 | 133 | $this->generateControllerTemplate($module, $module_path, $force, $controllerType); |
| 134 | 134 | $this->generateServiceTemplate($module, $module_path, $force); |
| 135 | 135 | $this->genereateAutoloaderTemplate($module, $module_path, $force); |
@@ -147,28 +147,28 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | private function createModuleModels($module, $path) |
| 149 | 149 | { |
| 150 | - $module_path = $path . $module; |
|
| 151 | - $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path); |
|
| 150 | + $module_path = $path.$module; |
|
| 151 | + $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path); |
|
| 152 | 152 | //Generamos las clases de propel y la configuración |
| 153 | - $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . |
|
| 154 | - "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel "; |
|
| 155 | - $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . |
|
| 156 | - DIRECTORY_SEPARATOR . "Config"; |
|
| 157 | - $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . |
|
| 158 | - "Config --output-dir=" . CORE_DIR . " --verbose"; |
|
| 159 | - $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt); |
|
| 160 | - $ret = shell_exec($exec . "build" . $opt . $schemaOpt); |
|
| 153 | + $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR. |
|
| 154 | + "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel "; |
|
| 155 | + $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path. |
|
| 156 | + DIRECTORY_SEPARATOR."Config"; |
|
| 157 | + $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR. |
|
| 158 | + "Config --output-dir=".CORE_DIR." --verbose"; |
|
| 159 | + $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt); |
|
| 160 | + $ret = shell_exec($exec."build".$opt.$schemaOpt); |
|
| 161 | 161 | |
| 162 | 162 | $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret"); |
| 163 | - $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . |
|
| 164 | - $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt); |
|
| 163 | + $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR. |
|
| 164 | + $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt); |
|
| 165 | 165 | $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret"); |
| 166 | 166 | |
| 167 | 167 | $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array( |
| 168 | 168 | "module" => $module, |
| 169 | 169 | )); |
| 170 | - $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . "Config" . |
|
| 171 | - DIRECTORY_SEPARATOR . "config.php", true); |
|
| 170 | + $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR."Config". |
|
| 171 | + DIRECTORY_SEPARATOR."config.php", true); |
|
| 172 | 172 | $this->log->infoLog("Generado config genérico para propel:\n $ret"); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -189,28 +189,28 @@ discard block |
||
| 189 | 189 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 190 | 190 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 191 | 191 | "class" => $class, |
| 192 | - "controllerType" => $class . "Base", |
|
| 192 | + "controllerType" => $class."Base", |
|
| 193 | 193 | "is_base" => false |
| 194 | 194 | )); |
| 195 | - $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 196 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
| 195 | + $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 196 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
| 197 | 197 | |
| 198 | 198 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
| 199 | 199 | "module" => $module, |
| 200 | 200 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 201 | 201 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 202 | - "class" => $class . "Base", |
|
| 202 | + "class" => $class."Base", |
|
| 203 | 203 | "service" => $class, |
| 204 | 204 | "controllerType" => $controllerType, |
| 205 | 205 | "is_base" => true, |
| 206 | 206 | "domain" => $class, |
| 207 | 207 | )); |
| 208 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 209 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
| 208 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 209 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
| 210 | 210 | |
| 211 | - $filename = $mod_path . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php"; |
|
| 211 | + $filename = $mod_path.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php"; |
|
| 212 | 212 | $test = true; |
| 213 | - if(!file_exists($filename)) { |
|
| 213 | + if (!file_exists($filename)) { |
|
| 214 | 214 | $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array( |
| 215 | 215 | "module" => $module, |
| 216 | 216 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | private function generateBaseApiTemplate($module, $mod_path, $force = false, $apiClass = "") |
| 232 | 232 | { |
| 233 | 233 | $created = true; |
| 234 | - $modelPath = $mod_path . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 235 | - $api_path = $mod_path . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
| 234 | + $modelPath = $mod_path.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 235 | + $api_path = $mod_path.$module.DIRECTORY_SEPARATOR.'Api'; |
|
| 236 | 236 | if (file_exists($modelPath)) { |
| 237 | 237 | $dir = dir($modelPath); |
| 238 | 238 | while ($file = $dir->read()) { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | //Generamos el fichero de configuración |
| 261 | 261 | $this->log->infoLog("Generamos fichero vacío de configuración"); |
| 262 | 262 | return $this->writeTemplateToFile("<?php\n\t", |
| 263 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
| 263 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
| 264 | 264 | $force); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | //Generamos el fichero de configuración |
| 276 | 276 | $this->log->infoLog("Generamos ficheros para assets base"); |
| 277 | 277 | $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", |
| 278 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", |
|
| 278 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", |
|
| 279 | 279 | $force); |
| 280 | 280 | $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", |
| 281 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", |
|
| 281 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", |
|
| 282 | 282 | $force); |
| 283 | 283 | return ($css && $js); |
| 284 | 284 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | "class" => $class, |
| 301 | 301 | )); |
| 302 | 302 | return $this->writeTemplateToFile($controller, |
| 303 | - $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php", |
|
| 303 | + $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php", |
|
| 304 | 304 | $force); |
| 305 | 305 | } |
| 306 | 306 | |
@@ -319,13 +319,13 @@ discard block |
||
| 319 | 319 | "autoloader" => preg_replace('/(\\\|\/)/', '_', $module), |
| 320 | 320 | "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module), |
| 321 | 321 | )); |
| 322 | - $autoload = $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force); |
|
| 322 | + $autoload = $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force); |
|
| 323 | 323 | |
| 324 | 324 | $this->log->infoLog("Generamos el phpunit"); |
| 325 | 325 | $phpUnitTemplate = $this->tpl->dump("generator/phpunit.template.twig", array( |
| 326 | 326 | "module" => $module, |
| 327 | 327 | )); |
| 328 | - $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path . DIRECTORY_SEPARATOR . "phpunit.xml.dist", $force); |
|
| 328 | + $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path.DIRECTORY_SEPARATOR."phpunit.xml.dist", $force); |
|
| 329 | 329 | return $autoload && $phpunit; |
| 330 | 330 | } |
| 331 | 331 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | "db" => $this->config->get("db_name"), |
| 347 | 347 | )); |
| 348 | 348 | return $this->writeTemplateToFile($schema, |
| 349 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
| 349 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
| 350 | 350 | $force); |
| 351 | 351 | } |
| 352 | 352 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
| 365 | 365 | )); |
| 366 | 366 | return $this->writeTemplateToFile($build_properties, |
| 367 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", |
|
| 367 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", |
|
| 368 | 368 | $force); |
| 369 | 369 | } |
| 370 | 370 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | "module" => $module, |
| 383 | 383 | )); |
| 384 | 384 | return $this->writeTemplateToFile($index, |
| 385 | - $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
| 385 | + $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
| 386 | 386 | $force); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -400,11 +400,11 @@ discard block |
||
| 400 | 400 | try { |
| 401 | 401 | $this->cache->storeData($filename, $fileContent, Cache::TEXT, true); |
| 402 | 402 | $created = true; |
| 403 | - } catch (\Exception $e) { |
|
| 403 | + }catch (\Exception $e) { |
|
| 404 | 404 | $this->log->errorLog($e->getMessage()); |
| 405 | 405 | } |
| 406 | - } else { |
|
| 407 | - $this->log->errorLog($filename . _(' not exists or cant write')); |
|
| 406 | + }else { |
|
| 407 | + $this->log->errorLog($filename._(' not exists or cant write')); |
|
| 408 | 408 | } |
| 409 | 409 | return $created; |
| 410 | 410 | } |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | )); |
| 434 | 434 | |
| 435 | 435 | return $this->writeTemplateToFile($controller, |
| 436 | - $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 436 | + $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | /** |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | "class" => $class, |
| 457 | 457 | )); |
| 458 | 458 | |
| 459 | - return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 459 | + return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | /** |
@@ -470,12 +470,12 @@ discard block |
||
| 470 | 470 | { |
| 471 | 471 | if (file_exists($filename_path)) { |
| 472 | 472 | $destfolder = basename($filename_path); |
| 473 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
| 473 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
| 474 | 474 | if (is_dir($filename_path)) { |
| 475 | - self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 476 | - } else { |
|
| 477 | - if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
| 478 | - throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 475 | + self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 476 | + }else { |
|
| 477 | + if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
| 478 | + throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -494,10 +494,10 @@ discard block |
||
| 494 | 494 | GeneratorHelper::createDir($dst); |
| 495 | 495 | while (false !== ($file = readdir($dir))) { |
| 496 | 496 | if (($file != '.') && ($file != '..')) { |
| 497 | - if (is_dir($src . '/' . $file)) { |
|
| 498 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
| 499 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
| 500 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
| 497 | + if (is_dir($src.'/'.$file)) { |
|
| 498 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
| 499 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
| 500 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | } |