@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Método que revisa las traducciones directorio a directorio |
| 27 | - * @param $path |
|
| 27 | + * @param string $path |
|
| 28 | 28 | * @param $locale |
| 29 | 29 | * @return array |
| 30 | 30 | */ |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * Servicio que genera la estructura base |
| 97 | - * @param $module |
|
| 98 | - * @param $mod_path |
|
| 97 | + * @param string $module |
|
| 98 | + * @param string $mod_path |
|
| 99 | 99 | */ |
| 100 | 100 | private function createModulePathTree($module, $mod_path) |
| 101 | 101 | { |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use PSFS\base\config\Config; |
| 6 | 6 | use PSFS\base\Service; |
| 7 | 7 | |
| 8 | - class GeneratorService extends Service{ |
|
| 8 | + class GeneratorService extends Service { |
|
| 9 | 9 | /** |
| 10 | 10 | * @Inyectable |
| 11 | 11 | * @var \PSFS\base\config\Config Servicio de configuración |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public static function findTranslations($path, $locale) |
| 32 | 32 | { |
| 33 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 34 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
| 33 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 34 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
| 35 | 35 | |
| 36 | 36 | $translations = array(); |
| 37 | - if(file_exists($path)) |
|
| 37 | + if (file_exists($path)) |
|
| 38 | 38 | { |
| 39 | 39 | $d = dir($path); |
| 40 | - while(false !== ($dir = $d->read())) |
|
| 40 | + while (false !== ($dir = $d->read())) |
|
| 41 | 41 | { |
| 42 | 42 | Config::createDir($locale_path); |
| 43 | - if(!file_exists($locale_path . 'translations.po')) { |
|
| 44 | - file_put_contents($locale_path . 'translations.po', ''); |
|
| 43 | + if (!file_exists($locale_path.'translations.po')) { |
|
| 44 | + file_put_contents($locale_path.'translations.po', ''); |
|
| 45 | 45 | } |
| 46 | 46 | $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir); |
| 47 | - $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ". $inspect_path . DIRECTORY_SEPARATOR ."*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
|
| 48 | - if(is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./',$dir) == 0) |
|
| 47 | + $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ".$inspect_path.DIRECTORY_SEPARATOR."*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
|
| 48 | + if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) |
|
| 49 | 49 | { |
| 50 | - $res = _('Revisando directorio: ') . $inspect_path; |
|
| 51 | - $res .= _('Comando ejecutado: '). $cmd_php; |
|
| 50 | + $res = _('Revisando directorio: ').$inspect_path; |
|
| 51 | + $res .= _('Comando ejecutado: ').$cmd_php; |
|
| 52 | 52 | $res .= shell_exec($cmd_php); |
| 53 | 53 | usleep(10); |
| 54 | 54 | $translations[] = $res; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function createStructureModule($module, $force = false, $type = "") |
| 70 | 70 | { |
| 71 | - $mod_path = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 71 | + $mod_path = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 72 | 72 | $module = ucfirst($module); |
| 73 | 73 | $this->createModulePath($module, $mod_path); |
| 74 | 74 | $this->createModulePathTree($module, $mod_path); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | //Creamos el directorio base de los módulos |
| 90 | 90 | Config::createDir($mod_path); |
| 91 | 91 | //Creamos la carpeta del módulo |
| 92 | - Config::createDir($mod_path . $module); |
|
| 92 | + Config::createDir($mod_path.$module); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | //Creamos las carpetas CORE del módulo |
| 103 | 103 | $this->log->infoLog("Generamos la estructura"); |
| 104 | 104 | $paths = array("Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test"); |
| 105 | - foreach($paths as $path) { |
|
| 106 | - Config::createDir($mod_path . $module . DIRECTORY_SEPARATOR . $path); |
|
| 105 | + foreach ($paths as $path) { |
|
| 106 | + Config::createDir($mod_path.$module.DIRECTORY_SEPARATOR.$path); |
|
| 107 | 107 | } |
| 108 | 108 | //Creamos las carpetas de los assets |
| 109 | 109 | $htmlPaths = array("css", "js", "img", "media", "font"); |
| 110 | - foreach($htmlPaths as $path) { |
|
| 111 | - Config::createDir($mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path); |
|
| 110 | + foreach ($htmlPaths as $path) { |
|
| 111 | + Config::createDir($mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
@@ -138,15 +138,15 @@ discard block |
||
| 138 | 138 | private function createModuleModels($module) |
| 139 | 139 | { |
| 140 | 140 | //Generamos las clases de propel y la configuración |
| 141 | - $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel "; |
|
| 142 | - $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config"; |
|
| 143 | - $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config --output-dir=" . CORE_DIR . " --verbose"; |
|
| 144 | - $ret = shell_exec($exec . "build" . $opt . $schemaOpt); |
|
| 141 | + $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR."vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel "; |
|
| 142 | + $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config"; |
|
| 143 | + $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config --output-dir=".CORE_DIR." --verbose"; |
|
| 144 | + $ret = shell_exec($exec."build".$opt.$schemaOpt); |
|
| 145 | 145 | |
| 146 | 146 | $this->log->infoLog("Generamos clases invocando a propel:\n $ret"); |
| 147 | - $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config" . $schemaOpt); |
|
| 147 | + $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config".$schemaOpt); |
|
| 148 | 148 | $this->log->infoLog("Generamos sql invocando a propel:\n $ret"); |
| 149 | - $ret = shell_exec($exec . "config:convert" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config"); |
|
| 149 | + $ret = shell_exec($exec."config:convert".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config"); |
|
| 150 | 150 | $this->log->infoLog("Generamos configuración invocando a propel:\n $ret"); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | "module" => $module, |
| 166 | 166 | "controllerType" => $controllerType, |
| 167 | 167 | )); |
| 168 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Controller" . DIRECTORY_SEPARATOR . "{$module}Controller.php", $force); |
|
| 168 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Controller".DIRECTORY_SEPARATOR."{$module}Controller.php", $force); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | private function generateBaseApiTemplate($module, $mod_path, $force = false, $controllerType = "") |
| 179 | 179 | { |
| 180 | 180 | $created = true; |
| 181 | - $modelPath = $mod_path . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 182 | - if(file_exists($modelPath)) { |
|
| 181 | + $modelPath = $mod_path.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 182 | + if (file_exists($modelPath)) { |
|
| 183 | 183 | $dir = dir($modelPath); |
| 184 | - while($file = $dir->read()) { |
|
| 185 | - if(!in_array($file, array('.', '..')) && !preg_match('/Query\.php$/i', $file) && preg_match('/\.php$/i', $file)) { |
|
| 184 | + while ($file = $dir->read()) { |
|
| 185 | + if (!in_array($file, array('.', '..')) && !preg_match('/Query\.php$/i', $file) && preg_match('/\.php$/i', $file)) { |
|
| 186 | 186 | $filename = str_replace(".php", "", $file); |
| 187 | 187 | $this->log->infoLog("Generamos Api BASES para {$filename}"); |
| 188 | 188 | $this->createApiBaseFile($module, $mod_path, $filename); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | //Generamos el fichero de configuración |
| 205 | 205 | $this->log->infoLog("Generamos fichero vacío de configuración"); |
| 206 | - return $this->writeTemplateToFile("<?php\n\t", $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", $force); |
|
| 206 | + return $this->writeTemplateToFile("<?php\n\t", $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", $force); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | //Generamos el fichero de configuración |
| 218 | 218 | $this->log->infoLog("Generamos ficheros para assets base"); |
| 219 | - $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", $mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", false); |
|
| 220 | - $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", $mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", false); |
|
| 219 | + $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", $mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", false); |
|
| 220 | + $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", $mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", false); |
|
| 221 | 221 | return ($css && $js); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $controller = $this->tpl->dump("generator/service.template.twig", array( |
| 235 | 235 | "module" => $module, |
| 236 | 236 | )); |
| 237 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$module}Service.php", $force); |
|
| 237 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$module}Service.php", $force); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $autoloader = $this->tpl->dump("generator/autoloader.template.twig", array( |
| 251 | 251 | "module" => $module, |
| 252 | 252 | )); |
| 253 | - return $this->writeTemplateToFile($autoloader, $mod_path . $module . DIRECTORY_SEPARATOR . "autoload.php", $force); |
|
| 253 | + return $this->writeTemplateToFile($autoloader, $mod_path.$module.DIRECTORY_SEPARATOR."autoload.php", $force); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | "module" => $module, |
| 268 | 268 | "db" => $this->config->get("db_name"), |
| 269 | 269 | )); |
| 270 | - return $this->writeTemplateToFile($schema, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", $force); |
|
| 270 | + return $this->writeTemplateToFile($schema, $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", $force); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | "pass" => $this->config->get("db_password"), |
| 288 | 288 | "db" => $this->config->get("db_name"), |
| 289 | 289 | )); |
| 290 | - return $this->writeTemplateToFile($build_properties, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", $force); |
|
| 290 | + return $this->writeTemplateToFile($build_properties, $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", $force); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $index = $this->tpl->dump("generator/index.template.twig", array( |
| 304 | 304 | "module" => $module, |
| 305 | 305 | )); |
| 306 | - return $this->writeTemplateToFile($index, $mod_path . $module . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", $force); |
|
| 306 | + return $this->writeTemplateToFile($index, $mod_path.$module.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", $force); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -317,13 +317,13 @@ discard block |
||
| 317 | 317 | $created = false; |
| 318 | 318 | if ($force || !file_exists($filename)) { |
| 319 | 319 | try { |
| 320 | - $this->cache->storeData($filename, $fileContent, Cache::TEXT,true); |
|
| 320 | + $this->cache->storeData($filename, $fileContent, Cache::TEXT, true); |
|
| 321 | 321 | $created = true; |
| 322 | - } catch(\Exception $e) { |
|
| 322 | + }catch (\Exception $e) { |
|
| 323 | 323 | $this->log->errorLog($e->getMessage()); |
| 324 | 324 | } |
| 325 | - } else{ |
|
| 326 | - $this->log->errorLog($filename . _(' not exists or cant write')); |
|
| 325 | + }else { |
|
| 326 | + $this->log->errorLog($filename._(' not exists or cant write')); |
|
| 327 | 327 | } |
| 328 | 328 | return $created; |
| 329 | 329 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | "api" => $api |
| 344 | 344 | )); |
| 345 | 345 | |
| 346 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 346 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -362,6 +362,6 @@ discard block |
||
| 362 | 362 | "api" => $api |
| 363 | 363 | )); |
| 364 | 364 | |
| 365 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 365 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 366 | 366 | } |
| 367 | 367 | } |
@@ -307,7 +307,7 @@ |
||
| 307 | 307 | if ($file->isFile()) { |
| 308 | 308 | try { |
| 309 | 309 | $this->tpl->loadTemplate(str_replace($tplDir.'/', '', $file)); |
| 310 | - } catch (\Exception $e) { |
|
| 310 | + }catch (\Exception $e) { |
|
| 311 | 311 | Logger::getInstance()->errorLog($e->getMessage()); |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $dump = ''; |
| 198 | 198 | try { |
| 199 | 199 | $dump = $this->tpl->render($tpl, $vars); |
| 200 | - }catch (\Exception $e) { |
|
| 200 | + } catch (\Exception $e) { |
|
| 201 | 201 | echo $e->getMessage()."<pre>".$e->getTraceAsString()."</pre>"; |
| 202 | 202 | } |
| 203 | 203 | return $dump; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | unset($_SERVER["PHP_AUTH_USER"]); |
| 395 | 395 | unset($_SERVER["PHP_AUTH_PW"]); |
| 396 | 396 | header_remove("Authorization"); |
| 397 | - }else { |
|
| 397 | + } else { |
|
| 398 | 398 | header('Authorization:'); |
| 399 | 399 | } |
| 400 | 400 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | try { |
| 141 | 141 | Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json", $final_data, Cache::JSON, true); |
| 142 | 142 | $saved = true; |
| 143 | - }catch (ConfigException $e) { |
|
| 143 | + } catch (ConfigException $e) { |
|
| 144 | 144 | Logger::getInstance()->errorLog($e->getMessage()); |
| 145 | 145 | } |
| 146 | 146 | return $saved; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | if (@mkdir($dir, 0775, true) === false) { |
| 183 | 183 | throw new \Exception(_('Can\'t create directory ').$dir); |
| 184 | 184 | } |
| 185 | - }catch (\Exception $e) { |
|
| 185 | + } catch (\Exception $e) { |
|
| 186 | 186 | if (!file_exists(dirname($dir))) { |
| 187 | 187 | throw new ConfigException($e->getMessage().$dir); |
| 188 | 188 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json")) |
| 47 | 47 | { |
| 48 | 48 | $this->loadConfigData(); |
| 49 | - } else { |
|
| 49 | + }else { |
|
| 50 | 50 | $this->debug = true; |
| 51 | 51 | } |
| 52 | 52 | return $this; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
| 198 | 198 | try { |
| 199 | 199 | @shell_exec("rm -rf ".WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
| 200 | - } catch(\Exception $e) { |
|
| 200 | + }catch (\Exception $e) { |
|
| 201 | 201 | Logger::getInstance()->errorLog($e->getMessage()); |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function loadConfigData() |
| 211 | 211 | { |
| 212 | - $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json", Cache::JSON, TRUE) ?: array(); |
|
| 212 | + $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json", Cache::JSON, TRUE) ?: array(); |
|
| 213 | 213 | $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE; |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | try { |
| 21 | 21 | $reflectionClass = new \ReflectionClass($this); |
| 22 | 22 | $properties = $reflectionClass->getProperties(); |
| 23 | - if(count($properties) > 0) { |
|
| 23 | + if (count($properties) > 0) { |
|
| 24 | 24 | /** @var \ReflectionProperty $property */ |
| 25 | - foreach($properties as $property) { |
|
| 25 | + foreach ($properties as $property) { |
|
| 26 | 26 | $dto[$property->getName()] = $property->getValue($this); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - } catch(\Exception $e) { |
|
| 29 | + }catch (\Exception $e) { |
|
| 30 | 30 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 31 | 31 | } |
| 32 | 32 | return $dto; |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function fromArray(array $object = array()) |
| 49 | 49 | { |
| 50 | - if(count($object) > 0) { |
|
| 51 | - foreach($object as $key => $value) { |
|
| 52 | - if(property_exists($this, $key)) { |
|
| 50 | + if (count($object) > 0) { |
|
| 51 | + foreach ($object as $key => $value) { |
|
| 52 | + if (property_exists($this, $key)) { |
|
| 53 | 53 | $this->$key = $value; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $order = array(); |
| 33 | 33 | if (count($order) > 0) { |
| 34 | - foreach($this->fields as $field => $direction) { |
|
| 35 | - if(strtolower($fieldToRemove) === strtolower($field)) { |
|
| 34 | + foreach ($this->fields as $field => $direction) { |
|
| 35 | + if (strtolower($fieldToRemove) === strtolower($field)) { |
|
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | $order[$field] = $direction; |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public static function parseDirection($direction = Order::ASC) |
| 62 | 62 | { |
| 63 | - if(preg_match('/^asc$/i', $direction)) { |
|
| 63 | + if (preg_match('/^asc$/i', $direction)) { |
|
| 64 | 64 | return Order::ASC; |
| 65 | - } else { |
|
| 65 | + }else { |
|
| 66 | 66 | return Order::DESC; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | if (!$this->debug && !file_exists($base.$this->hash.".js")) { |
| 160 | - $this->storeContents($base.$this->hash.".js", $data);//Minifier::minify($data)); |
|
| 160 | + $this->storeContents($base.$this->hash.".js", $data); //Minifier::minify($data)); |
|
| 161 | 161 | } |
| 162 | 162 | return $this; |
| 163 | 163 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | foreach ($this->compiled_files as $file) { |
| 197 | 197 | echo "\t\t<script type='text/javascript' src='{$file}'></script>\n"; |
| 198 | 198 | } |
| 199 | - } else { |
|
| 199 | + }else { |
|
| 200 | 200 | echo "\t\t<script type='text/javascript' src='/js/".$this->hash.".js'></script>\n"; |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | foreach ($this->compiled_files as $file) { |
| 211 | 211 | echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>"; |
| 212 | 212 | } |
| 213 | - } else { |
|
| 213 | + }else { |
|
| 214 | 214 | echo "\t\t<link href='/css/".$this->hash.".css' rel='stylesheet' media='screen, print'>"; |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $this->log->infoLog("$orig copiado a $dest"); |
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | - } catch (\Exception $e) { |
|
| 238 | + }catch (\Exception $e) { |
|
| 239 | 239 | $this->log->errorLog($e->getMessage()); |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | if ($this->debug) { |
| 265 | 265 | $data = file_get_contents($file); |
| 266 | 266 | $this->storeContents($base.$file_path, $data); |
| 267 | - } else { |
|
| 267 | + }else { |
|
| 268 | 268 | $data .= file_get_contents($file); |
| 269 | 269 | } |
| 270 | 270 | $this->compiled_files[] = "/css/".$file_path; |
@@ -303,7 +303,7 @@ |
||
| 303 | 303 | $js = file_get_contents($file); |
| 304 | 304 | try { |
| 305 | 305 | $data .= ";\n".$js; |
| 306 | - }catch (\Exception $e) { |
|
| 306 | + } catch (\Exception $e) { |
|
| 307 | 307 | throw new ConfigException($e->getMessage()); |
| 308 | 308 | } |
| 309 | 309 | return $data; |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | $tmp = array(); |
| 136 | 136 | if (NULL === $node) { |
| 137 | 137 | $node = $value; |
| 138 | - }else { |
|
| 138 | + } else { |
|
| 139 | 139 | $tmp = $this->getTmpAttribute($node); |
| 140 | 140 | } |
| 141 | 141 | $tmp[] = $value->getAttribute("value"); |
@@ -22,7 +22,9 @@ |
||
| 22 | 22 | $class = get_called_class(); |
| 23 | 23 | if (!array_key_exists($class, self::$instance) || !self::$instance[$class] instanceof $class) { |
| 24 | 24 | self::$instance[$class] = new $class(func_get_args()); |
| 25 | - if (method_exists(self::$instance[$class], "init")) self::$instance[$class]->init(); |
|
| 25 | + if (method_exists(self::$instance[$class], "init")) { |
|
| 26 | + self::$instance[$class]->init(); |
|
| 27 | + } |
|
| 26 | 28 | } |
| 27 | 29 | return self::$instance[$class]; |
| 28 | 30 | } |
@@ -1,19 +1,37 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Symfony\Component\Finder\Finder; |
| 3 | 3 | |
| 4 | - if (!defined('SOURCE_DIR'))define('SOURCE_DIR', __DIR__); |
|
| 4 | + if (!defined('SOURCE_DIR')) { |
|
| 5 | + define('SOURCE_DIR', __DIR__); |
|
| 6 | + } |
|
| 5 | 7 | if (preg_match('/vendor/', SOURCE_DIR)) |
| 6 | 8 | { |
| 7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
| 8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
| 9 | - }else { |
|
| 10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
| 11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
| 12 | - } |
|
| 13 | - if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
| 14 | - if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
| 15 | - if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
| 16 | - if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
| 9 | + if (!defined('BASE_DIR')) { |
|
| 10 | + define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
| 11 | + } |
|
| 12 | + if (!defined('CORE_DIR')) { |
|
| 13 | + define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
| 14 | + } |
|
| 15 | + } else { |
|
| 16 | + if (!defined('BASE_DIR')) { |
|
| 17 | + define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
| 18 | + } |
|
| 19 | + if (!defined('CORE_DIR')) { |
|
| 20 | + define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
| 21 | + } |
|
| 22 | + } |
|
| 23 | + if (!defined('LOG_DIR')) { |
|
| 24 | + define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
| 25 | + } |
|
| 26 | + if (!defined('CACHE_DIR')) { |
|
| 27 | + define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
| 28 | + } |
|
| 29 | + if (!defined('CONFIG_DIR')) { |
|
| 30 | + define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
| 31 | + } |
|
| 32 | + if (!defined('WEB_DIR')) { |
|
| 33 | + define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
| 34 | + } |
|
| 17 | 35 | |
| 18 | 36 | //Cargamos en memoria la función de desarrollo PRE |
| 19 | 37 | if (!function_exists('pre')) { |