@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | foreach ($domains as $domain => $routes) { |
| 36 | 36 | $pDomain = str_replace('@', '', $domain); |
| 37 | 37 | $pDomain = str_replace('/', '', $pDomain); |
| 38 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
| 38 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
| 39 | 39 | } |
| 40 | 40 | return $this->json($response); |
| 41 | 41 | } |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function config() |
| 53 | 53 | { |
| 54 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
| 55 | - if(defined('PSFS_UNIT_TESTING_EXECUTION')) { |
|
| 54 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
| 55 | + if (defined('PSFS_UNIT_TESTING_EXECUTION')) { |
|
| 56 | 56 | throw new ConfigException('CONFIG'); |
| 57 | 57 | } |
| 58 | 58 | $form = new ConfigForm(Router::getInstance()->getRoute('admin-config'), Config::$required, Config::$optional, Config::getInstance()->dumpConfig()); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | Security::getInstance()->setFlash("callback_message", t("Configuración actualizada correctamente")); |
| 91 | 91 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
| 92 | - } else { |
|
| 92 | + }else { |
|
| 93 | 93 | throw new HttpException(t('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | GeneratorHelper::checkCustomNamespaceApi($apiClass); |
| 64 | 64 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
| 65 | 65 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente"))); |
| 66 | - Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
|
| 66 | + Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
|
| 67 | 67 | } catch (Exception $e) { |
| 68 | 68 | Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
| 69 | 69 | Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage())); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function generateModule() |
| 35 | 35 | { |
| 36 | - Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri()); |
|
| 36 | + Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri()); |
|
| 37 | 37 | /* @var $form ConfigForm */ |
| 38 | 38 | $form = new ModuleForm(); |
| 39 | 39 | $form->build(); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
| 65 | 65 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente"))); |
| 66 | 66 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
| 67 | - } catch (Exception $e) { |
|
| 68 | - Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
| 67 | + }catch (Exception $e) { |
|
| 68 | + Logger::log($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
| 69 | 69 | Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage())); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | GeneratorHelper::createDir(dirname($path)); |
| 57 | 57 | if (false === FileHelper::writeFile($path, $data)) { |
| 58 | - throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ') . $path); |
|
| 58 | + throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ').$path); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | Inspector::stats('[Cache] Gathering data from cache', Inspector::SCOPE_DEBUG); |
| 71 | 71 | $data = null; |
| 72 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 72 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 73 | 73 | if (file_exists($absolutePath)) { |
| 74 | 74 | $data = FileHelper::readFile($absolutePath); |
| 75 | 75 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
| 86 | 86 | { |
| 87 | 87 | Inspector::stats('[Cache] Checking expiration', Inspector::SCOPE_DEBUG); |
| 88 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 88 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 89 | 89 | $lasModificationDate = filemtime($absolutePath); |
| 90 | 90 | return ($lasModificationDate + $expires <= time()); |
| 91 | 91 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | Inspector::stats('[Cache] Store data in cache', Inspector::SCOPE_DEBUG); |
| 154 | 154 | $data = self::transformData($data, $transform); |
| 155 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 155 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 156 | 156 | $this->saveTextToFile($data, $absolutePath); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | public function readFromCache($path, $expires = 300, $function = null, $transform = Cache::TEXT) |
| 169 | 169 | { |
| 170 | 170 | $data = null; |
| 171 | - Inspector::stats('[Cache] Reading data from cache: ' . json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
| 172 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
| 171 | + Inspector::stats('[Cache] Reading data from cache: '.json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
| 172 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
| 173 | 173 | if (is_callable($function) && $this->hasExpiredCache($path, $expires)) { |
| 174 | 174 | $data = $function(); |
| 175 | 175 | $this->storeData($path, $data, $transform); |
| 176 | - } else { |
|
| 176 | + }else { |
|
| 177 | 177 | $data = $this->getDataFromFile($path, $transform); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -219,20 +219,20 @@ discard block |
||
| 219 | 219 | $query[Api::HEADER_API_LANG] = Request::header(Api::HEADER_API_LANG, 'es'); |
| 220 | 220 | $filename = FileHelper::generateHashFilename($action['http'], $action['slug'], $query); |
| 221 | 221 | $hashPath = FileHelper::generateCachePath($action, $query); |
| 222 | - Inspector::stats('[Cache] Cache file calculated: ' . json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
| 222 | + Inspector::stats('[Cache] Cache file calculated: '.json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
| 223 | 223 | Logger::log('Cache file calculated', LOG_DEBUG, ['file' => $filename, 'hash' => $hashPath]); |
| 224 | 224 | } |
| 225 | 225 | return [$hashPath, $filename]; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | public function flushCache() { |
| 229 | - if(Config::getParam('cache.data.enable', false)) { |
|
| 229 | + if (Config::getParam('cache.data.enable', false)) { |
|
| 230 | 230 | Inspector::stats('[Cache] Flushing cache', Inspector::SCOPE_DEBUG); |
| 231 | 231 | $action = Security::getInstance()->getSessionKey(self::CACHE_SESSION_VAR); |
| 232 | - if(is_array($action)) { |
|
| 233 | - $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
| 234 | - if(!file_exists($hashPath)) { |
|
| 235 | - $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath; |
|
| 232 | + if (is_array($action)) { |
|
| 233 | + $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
| 234 | + if (!file_exists($hashPath)) { |
|
| 235 | + $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath; |
|
| 236 | 236 | } |
| 237 | 237 | FileHelper::deleteDir($hashPath); |
| 238 | 238 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | foreach ($compiledFiles as $file) { |
| 24 | 24 | echo "\t\t<script type='text/javascript' src='{$file}'></script>\n"; |
| 25 | 25 | } |
| 26 | - } else { |
|
| 27 | - echo "\t\t<script type='text/javascript' src='" . $baseUrl . "/js/" . $hash . ".js'" . |
|
| 26 | + }else { |
|
| 27 | + echo "\t\t<script type='text/javascript' src='".$baseUrl."/js/".$hash.".js'". |
|
| 28 | 28 | "></script>\n"; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function putDebugJs($pathParts, $base, $file, $hash, array &$compiledFiles) |
| 42 | 42 | { |
| 43 | - $filePath = $hash . "_" . $pathParts[count($pathParts) - 1]; |
|
| 44 | - $compiledFiles[] = "/js/" . $filePath; |
|
| 43 | + $filePath = $hash."_".$pathParts[count($pathParts) - 1]; |
|
| 44 | + $compiledFiles[] = "/js/".$filePath; |
|
| 45 | 45 | $data = ""; |
| 46 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file)) { |
|
| 46 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file)) { |
|
| 47 | 47 | $data = file_get_contents($file); |
| 48 | - AssetsHelper::storeContents($base . $filePath, $data); |
|
| 48 | + AssetsHelper::storeContents($base.$filePath, $data); |
|
| 49 | 49 | } |
| 50 | 50 | return $data; |
| 51 | 51 | } |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function compileJs(array $files, $basePath, $hash, array &$compiledFiles) |
| 63 | 63 | { |
| 64 | - $base = $basePath . "js" . DIRECTORY_SEPARATOR; |
|
| 64 | + $base = $basePath."js".DIRECTORY_SEPARATOR; |
|
| 65 | 65 | $debug = Config::getParam('debug'); |
| 66 | - if ($debug || !file_exists($base . $hash . ".js")) { |
|
| 66 | + if ($debug || !file_exists($base.$hash.".js")) { |
|
| 67 | 67 | $data = ''; |
| 68 | 68 | if (0 < count($files)) { |
| 69 | 69 | $minifier = new JS(); |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | if (file_exists($file)) { |
| 73 | 73 | if ($debug) { |
| 74 | 74 | $data = $this->putDebugJs($pathParts, $base, $file, $hash, $compiledFiles); |
| 75 | - } elseif (!file_exists($base . $hash . ".js")) { |
|
| 75 | + } elseif (!file_exists($base.$hash.".js")) { |
|
| 76 | 76 | $minifier->add($file); |
| 77 | 77 | //$data = $this->putProductionJs($base, $file, $data); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | - if($debug) { |
|
| 82 | - AssetsHelper::storeContents($base . $hash . ".js", $data); |
|
| 83 | - } else { |
|
| 81 | + if ($debug) { |
|
| 82 | + AssetsHelper::storeContents($base.$hash.".js", $data); |
|
| 83 | + }else { |
|
| 84 | 84 | $this->dumpJs($hash, $base, $minifier); |
| 85 | 85 | } |
| 86 | 86 | unset($minifier); |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | ini_set('memory_limit', -1); |
| 102 | 102 | GeneratorHelper::createDir($base); |
| 103 | 103 | if (Config::getParam('assets.obfuscate', false)) { |
| 104 | - $minifier->gzip($base . $hash . ".js"); |
|
| 105 | - } else { |
|
| 106 | - $minifier->minify($base . $hash . ".js"); |
|
| 104 | + $minifier->gzip($base.$hash.".js"); |
|
| 105 | + }else { |
|
| 106 | + $minifier->minify($base.$hash.".js"); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $path = explode("/", $string); |
| 71 | 71 | $originalFilename = end($path); |
| 72 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 72 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 73 | 73 | $debug = Config::getParam('debug'); |
| 74 | 74 | $cache = Config::getParam('cache.var'); |
| 75 | - $cache = $cache ? '.' . $cache : ''; |
|
| 75 | + $cache = $cache ? '.'.$cache : ''; |
|
| 76 | 76 | $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión |
| 77 | 77 | $mime = finfo_file($finfo, $filenamePath); |
| 78 | 78 | $extension = explode(".", $string); |
| 79 | 79 | $extension = end($extension); |
| 80 | - $file = "/" . substr(md5($string), 0, 8) . "." . $extension; |
|
| 80 | + $file = "/".substr(md5($string), 0, 8).".".$extension; |
|
| 81 | 81 | $htmlBase = ''; |
| 82 | 82 | finfo_close($finfo); |
| 83 | 83 | if (preg_match('/\.css$/i', $string)) { |
| 84 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
| 84 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
| 85 | 85 | $htmlBase = "css"; |
| 86 | 86 | } elseif (preg_match('/\.js$/i', $string)) { |
| 87 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
| 87 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
| 88 | 88 | $htmlBase = "js"; |
| 89 | 89 | } elseif (preg_match("/image/i", $mime)) { |
| 90 | 90 | $htmlBase = "img"; |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | $file = $name; |
| 99 | 99 | } |
| 100 | 100 | if ($debug) { |
| 101 | - $file = str_replace("." . $extension, "_" . $originalFilename, $file); |
|
| 101 | + $file = str_replace(".".$extension, "_".$originalFilename, $file); |
|
| 102 | 102 | } |
| 103 | - $filePath = $htmlBase . $file; |
|
| 103 | + $filePath = $htmlBase.$file; |
|
| 104 | 104 | |
| 105 | 105 | return array($base, $htmlBase, $filePath); |
| 106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | GeneratorHelper::createDir(dirname($path)); |
| 117 | 117 | if ("" !== $content && false === file_put_contents($path, $content)) { |
| 118 | - throw new ConfigException(t('No se tienen permisos para escribir en ' . $path)); |
|
| 118 | + throw new ConfigException(t('No se tienen permisos para escribir en '.$path)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | protected $isMultipart = false; |
| 78 | 78 | |
| 79 | 79 | protected function closeConnection() { |
| 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 |
||
| 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 |
||
| 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 |
||
| 122 | 122 | public function setUrl(string $url, bool $cleanContext = true) |
| 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 |
||
| 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 |
||
| 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 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function createStructureModule($module, $force = false, $type = "", $apiClass = "") |
| 41 | 41 | { |
| 42 | - $modPath = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 42 | + $modPath = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 43 | 43 | $module = ucfirst($module); |
| 44 | 44 | $this->createModulePath($module, $modPath); |
| 45 | 45 | $this->createModulePathTree($module, $modPath); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '') |
| 62 | 62 | { |
| 63 | - $modulePath = $modPath . $module; |
|
| 63 | + $modulePath = $modPath.$module; |
|
| 64 | 64 | $this->generateControllerTemplate($module, $modulePath, $force, $controllerType); |
| 65 | 65 | $this->generateServiceTemplate($module, $modulePath, $force); |
| 66 | 66 | $this->generateSchemaTemplate($module, $modulePath, $force); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->genereateAutoloaderTemplate($module, $modulePath, $force); |
| 81 | 81 | $this->generatePropertiesTemplate($module, $modulePath, $force); |
| 82 | 82 | $this->generateConfigTemplate($modulePath, $force); |
| 83 | - $this->createModuleModels($module, CORE_DIR . DIRECTORY_SEPARATOR); |
|
| 83 | + $this->createModuleModels($module, CORE_DIR.DIRECTORY_SEPARATOR); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -100,28 +100,28 @@ discard block |
||
| 100 | 100 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 101 | 101 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 102 | 102 | "class" => $class, |
| 103 | - "controllerType" => $class . "Base", |
|
| 103 | + "controllerType" => $class."Base", |
|
| 104 | 104 | "is_base" => false |
| 105 | 105 | )); |
| 106 | - $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
| 107 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
| 106 | + $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
| 107 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
| 108 | 108 | |
| 109 | 109 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
| 110 | 110 | "module" => $module, |
| 111 | 111 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 112 | 112 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 113 | - "class" => $class . "Base", |
|
| 113 | + "class" => $class."Base", |
|
| 114 | 114 | "service" => $class, |
| 115 | 115 | "controllerType" => $controllerType, |
| 116 | 116 | "is_base" => true, |
| 117 | 117 | "domain" => $class, |
| 118 | 118 | )); |
| 119 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
| 120 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
| 119 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
| 120 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
| 121 | 121 | |
| 122 | - $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php"; |
|
| 122 | + $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php"; |
|
| 123 | 123 | $test = true; |
| 124 | - if(!file_exists($filename)) { |
|
| 124 | + if (!file_exists($filename)) { |
|
| 125 | 125 | $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array( |
| 126 | 126 | "module" => $module, |
| 127 | 127 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | private function createModuleModels($module, $path) |
| 142 | 142 | { |
| 143 | - $modulePath = $path . $module; |
|
| 144 | - $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $modulePath); |
|
| 143 | + $modulePath = $path.$module; |
|
| 144 | + $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $modulePath); |
|
| 145 | 145 | |
| 146 | 146 | $configGenerator = $this->getConfigGenerator($modulePath); |
| 147 | 147 | |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array( |
| 152 | 152 | "module" => $module, |
| 153 | 153 | )); |
| 154 | - $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" . |
|
| 155 | - DIRECTORY_SEPARATOR . "config.php", true); |
|
| 154 | + $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config". |
|
| 155 | + DIRECTORY_SEPARATOR."config.php", true); |
|
| 156 | 156 | Logger::log("Generado config genérico para propel"); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "") |
| 168 | 168 | { |
| 169 | 169 | $created = true; |
| 170 | - $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 171 | - $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
| 170 | + $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 171 | + $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api'; |
|
| 172 | 172 | if (file_exists($modelPath)) { |
| 173 | 173 | $dir = dir($modelPath); |
| 174 | 174 | $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | //Generamos el fichero de configuración |
| 187 | 187 | Logger::log("Generamos fichero vacío de configuración"); |
| 188 | 188 | return $this->writeTemplateToFile("<?php\n\t", |
| 189 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
| 189 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
| 190 | 190 | $force); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | "db" => $this->config->get("db_name"), |
| 208 | 208 | )); |
| 209 | 209 | return $this->writeTemplateToFile($schema, |
| 210 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
| 210 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
| 211 | 211 | $force); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
| 226 | 226 | )); |
| 227 | 227 | return $this->writeTemplateToFile($buildProperties, |
| 228 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php", |
|
| 228 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php", |
|
| 229 | 229 | $force); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | "module" => $module, |
| 244 | 244 | )); |
| 245 | 245 | return $this->writeTemplateToFile($index, |
| 246 | - $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
| 246 | + $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
| 247 | 247 | $force); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | )); |
| 274 | 274 | |
| 275 | 275 | return $this->writeTemplateToFile($controller, |
| 276 | - $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 276 | + $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | "package" => $package, |
| 299 | 299 | )); |
| 300 | 300 | |
| 301 | - return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 301 | + return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -315,15 +315,15 @@ discard block |
||
| 315 | 315 | $base = $dir->path; |
| 316 | 316 | while ($file = $dir->read()) { |
| 317 | 317 | if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) { |
| 318 | - if (is_dir($base . DIRECTORY_SEPARATOR . $file)) { |
|
| 319 | - $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file); |
|
| 320 | - } else if (!preg_match('/Query\.php$/i', $file) |
|
| 318 | + if (is_dir($base.DIRECTORY_SEPARATOR.$file)) { |
|
| 319 | + $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file); |
|
| 320 | + }else if (!preg_match('/Query\.php$/i', $file) |
|
| 321 | 321 | && !preg_match('/I18n\.php$/i', $file) |
| 322 | 322 | && preg_match('/\.php$/i', $file) |
| 323 | 323 | ) { |
| 324 | 324 | $filename = str_replace(".php", "", $file); |
| 325 | 325 | $this->log->addLog("Generamos Api BASES para {$filename}"); |
| 326 | - if($this->checkIfIsModel($module, $filename, $package)) { |
|
| 326 | + if ($this->checkIfIsModel($module, $filename, $package)) { |
|
| 327 | 327 | $this->createApiBaseFile($module, $apiPath, $filename, $apiClass, $package); |
| 328 | 328 | $this->createApi($module, $apiPath, $force, $filename, $package); |
| 329 | 329 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $parts[] = $package; |
| 347 | 347 | } |
| 348 | 348 | $parts[] = $filename; |
| 349 | - $namespace = '\\' . implode('\\', $parts); |
|
| 349 | + $namespace = '\\'.implode('\\', $parts); |
|
| 350 | 350 | $reflectorClass = new \ReflectionClass($namespace); |
| 351 | 351 | $isModel = $reflectorClass->isInstantiable(); |
| 352 | 352 | return $isModel; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | // autoloader |
| 15 | 15 | function PSFSAutoloader($class) |
| 16 | 16 | { |
| 17 | - Logger::log("Trying to load class {$class} with " . __FILE__); |
|
| 17 | + Logger::log("Trying to load class {$class} with ".__FILE__); |
|
| 18 | 18 | // it only autoload class into the Rain scope |
| 19 | 19 | if (str_contains($class, 'PSFS')) { |
| 20 | 20 | // Change order src |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | $path = str_replace("\\", DIRECTORY_SEPARATOR, $class); |
| 24 | 24 | |
| 25 | 25 | // filepath |
| 26 | - $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php"; |
|
| 26 | + $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php"; |
|
| 27 | 27 | |
| 28 | 28 | // require the file |
| 29 | 29 | if (file_exists($abs_path)) { |
| 30 | 30 | require_once $abs_path; |
| 31 | - } else { |
|
| 32 | - Logger::log("{$class} not loaded with " . __FILE__); |
|
| 31 | + }else { |
|
| 32 | + Logger::log("{$class} not loaded with ".__FILE__); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | return false; |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $now = new \DateTime(); |
| 19 | 19 | $now->setTimezone(new \DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid'))); |
| 20 | 20 | $config = Config::getInstance()->dumpConfig(); |
| 21 | - $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His'); |
|
| 21 | + $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His'); |
|
| 22 | 22 | Config::save($config); |
| 23 | 23 | return $config[self::CACHE_VAR_TAG]; |
| 24 | 24 | } |