@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $payload = $this->extractModelFields($namespace); |
92 | 92 | $reflector = new ReflectionClass($namespace); |
93 | 93 | $shortName = $reflector->getShortName(); |
94 | - } else { |
|
94 | + }else { |
|
95 | 95 | $namespace = $model; |
96 | 96 | $shortName = $model; |
97 | 97 | } |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | if ($module === $requestModule && !preg_match('/^ROOT/i', $module)) { |
171 | 171 | $modules = [ |
172 | 172 | 'name' => $module, |
173 | - 'path' => realpath(dirname($info['base'] . DIRECTORY_SEPARATOR . '..')), |
|
173 | + 'path' => realpath(dirname($info['base'].DIRECTORY_SEPARATOR.'..')), |
|
174 | 174 | ]; |
175 | 175 | } |
176 | - } catch (Exception $e) { |
|
176 | + }catch (Exception $e) { |
|
177 | 177 | $modules[] = $e->getMessage(); |
178 | 178 | } |
179 | 179 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) { |
217 | 217 | $payload = $this->extractDtoProperties($namespace); |
218 | 218 | } |
219 | - } catch (Exception $e) { |
|
219 | + }catch (Exception $e) { |
|
220 | 220 | Logger::log($e->getMessage(), LOG_ERR); |
221 | 221 | } |
222 | 222 |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $formatted = [ |
87 | 87 | "swagger" => "2.0", |
88 | 88 | "host" => preg_replace('/^(http|https)\:\/\/(.*)\/$/i', '$2', Router::getInstance()->getRoute('', true)), |
89 | - "basePath" => '/' . $module['name'] . '/api', |
|
89 | + "basePath" => '/'.$module['name'].'/api', |
|
90 | 90 | "schemes" => [Request::getInstance()->getServer('HTTPS') === 'on' ? 'https' : 'http'], |
91 | 91 | "info" => [ |
92 | - "title" => t('Documentación API módulo ') . $module['name'], |
|
92 | + "title" => t('Documentación API módulo ').$module['name'], |
|
93 | 93 | "version" => Config::getParam('api.version', '1.0.0'), |
94 | 94 | "contact" => [ |
95 | 95 | "name" => Config::getParam("author", "Fran López"), |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | foreach ($endpoints as $model) { |
102 | 102 | foreach ($model as $endpoint) { |
103 | 103 | if (!preg_match('/^\/(admin|api)\//i', $endpoint['url']) && strlen($endpoint['url'])) { |
104 | - $url = preg_replace('/\/' . $module['name'] . '\/api/i', '', $endpoint['url']); |
|
104 | + $url = preg_replace('/\/'.$module['name'].'\/api/i', '', $endpoint['url']); |
|
105 | 105 | $description = $endpoint['description']; |
106 | 106 | $method = strtolower($endpoint['method']); |
107 | 107 | $paths[$url][$method] = [ |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | ksort($dtos); |
145 | - uasort($paths, function ($path1, $path2) { |
|
145 | + uasort($paths, function($path1, $path2) { |
|
146 | 146 | $key1 = array_keys($path1)[0]; |
147 | 147 | $key2 = array_keys($path2)[0]; |
148 | 148 | return strcmp($path1[$key1]['tags'][0], $path2[$key2]['tags'][0]); |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | $modelDto['objects'][$dtoName][$param] = [ |
167 | 167 | 'type' => 'array', |
168 | 168 | 'items' => [ |
169 | - '$ref' => '#/definitions/' . $info['type'], |
|
169 | + '$ref' => '#/definitions/'.$info['type'], |
|
170 | 170 | ] |
171 | 171 | ]; |
172 | - } else { |
|
172 | + }else { |
|
173 | 173 | $modelDto['objects'][$dtoName][$param] = [ |
174 | 174 | 'type' => 'object', |
175 | - '$ref' => '#/definitions/' . $info['type'], |
|
175 | + '$ref' => '#/definitions/'.$info['type'], |
|
176 | 176 | ]; |
177 | 177 | } |
178 | 178 | $modelDto['objects'][$info['class']] = $info['properties']; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if (array_key_exists('objects', $paramDto)) { |
181 | 181 | $modelDto['objects'] = array_merge($modelDto['objects'], $paramDto['objects']); |
182 | 182 | } |
183 | - } else { |
|
183 | + }else { |
|
184 | 184 | $modelDto['objects'][$dtoName][$param] = $info; |
185 | 185 | } |
186 | 186 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $return = $this->extractReturn($modelNamespace, $docComments); |
212 | 212 | $url = array_pop($route); |
213 | 213 | $methodInfo = [ |
214 | - 'url' => str_replace('/' . $module . '/api', '', $url), |
|
214 | + 'url' => str_replace('/'.$module.'/api', '', $url), |
|
215 | 215 | 'method' => $info['http'], |
216 | 216 | 'description' => $info['label'], |
217 | 217 | 'return' => $return, |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $this->setRequestParams($method, $methodInfo, $modelNamespace, $docComments); |
223 | 223 | $this->setQueryParams($method, $methodInfo); |
224 | 224 | $this->setRequestHeaders($reflection, $methodInfo); |
225 | - } catch (Exception $e) { |
|
225 | + }catch (Exception $e) { |
|
226 | 226 | Logger::log($e->getMessage(), LOG_ERR); |
227 | 227 | } |
228 | 228 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | foreach ($method->getParameters() as $parameter) { |
323 | 323 | $parameterName = $parameter->getName(); |
324 | 324 | $types = []; |
325 | - preg_match_all('/\@param\ (.*)\ \$' . $parameterName . '$/im', $docComments, $types); |
|
325 | + preg_match_all('/\@param\ (.*)\ \$'.$parameterName.'$/im', $docComments, $types); |
|
326 | 326 | if (count($types) > 1 && count($types[1]) > 0) { |
327 | 327 | $methodInfo['parameters'][$parameterName] = $types[1][0]; |
328 | 328 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | ]; |
44 | 44 | if ($endpoint['payload']['is_array']) { |
45 | 45 | $schema['items'] = [ |
46 | - '$ref' => '#/definitions/' . $endpoint['payload']['type'], |
|
46 | + '$ref' => '#/definitions/'.$endpoint['payload']['type'], |
|
47 | 47 | ]; |
48 | - } else { |
|
49 | - $schema['$ref'] = '#/definitions/' . $endpoint['payload']['type']; |
|
48 | + }else { |
|
49 | + $schema['$ref'] = '#/definitions/'.$endpoint['payload']['type']; |
|
50 | 50 | } |
51 | 51 | if (!self::searchPayloadParam($paths[$url][$method]['parameters'], $endpoint['payload']['type'])) { |
52 | 52 | $paths[$url][$method]['parameters'][] = [ |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | if (array_key_exists('data', $endpoint['return']) && count(array_keys($object)) === count(array_keys($endpoint['return']['data']))) { |
78 | 78 | $classDefinition = [ |
79 | 79 | 'type' => 'object', |
80 | - '$ref' => '#/definitions/' . $class, |
|
80 | + '$ref' => '#/definitions/'.$class, |
|
81 | 81 | ]; |
82 | - } else { |
|
82 | + }else { |
|
83 | 83 | $classDefinition = [ |
84 | 84 | 'type' => 'array', |
85 | 85 | 'items' => [ |
86 | - '$ref' => '#/definitions/' . $class, |
|
86 | + '$ref' => '#/definitions/'.$class, |
|
87 | 87 | ], |
88 | 88 | ]; |
89 | 89 | } |
@@ -152,7 +152,7 @@ |
||
152 | 152 | { |
153 | 153 | if ($mappedColumn->getSize() > 100) { |
154 | 154 | $fDto = self::createField($field, Field::TEXTAREA_TYPE, $required); |
155 | - } else { |
|
155 | + }else { |
|
156 | 156 | $fDto = self::generateStringField($field, $required); |
157 | 157 | } |
158 | 158 | return $fDto; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | if (!headers_sent()) { |
46 | 46 | // TODO include this headers in Template class output method |
47 | 47 | header('Access-Control-Allow-Credentials: true'); |
48 | - header('Access-Control-Allow-Origin: ' . Request::getInstance()->getServer('HTTP_ORIGIN', '*')); |
|
48 | + header('Access-Control-Allow-Origin: '.Request::getInstance()->getServer('HTTP_ORIGIN', '*')); |
|
49 | 49 | header('Vary: Origin'); |
50 | 50 | header('Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH, OPTIONS, HEAD'); |
51 | - header('Access-Control-Allow-Headers: ' . implode(', ', self::getCorsHeaders())); |
|
51 | + header('Access-Control-Allow-Headers: '.implode(', ', self::getCorsHeaders())); |
|
52 | 52 | } |
53 | 53 | if (Request::getInstance()->getMethod() === Request::VERB_OPTIONS) { |
54 | 54 | Logger::log('Returning OPTIONS header confirmation for CORS pre flight requests', LOG_DEBUG); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return $ip; |
79 | 79 | } |
80 | 80 | } |
81 | - } else { |
|
81 | + }else { |
|
82 | 82 | if (self::validateIpAddress($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
83 | 83 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
84 | 84 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $platform = trim(Config::getInstance()->get('platform.name')); |
35 | 35 | header('HTTP/1.1 401 Unauthorized'); |
36 | - header('WWW-Authenticate: Basic Realm="' . $platform . '"'); |
|
36 | + header('WWW-Authenticate: Basic Realm="'.$platform.'"'); |
|
37 | 37 | echo t('Zona restringida'); |
38 | 38 | exit(); |
39 | 39 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $admin['class'] = 'primary'; |
76 | 76 | break; |
77 | 77 | } |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $admin['class'] = 'primary'; |
80 | 80 | } |
81 | 81 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $dump = ''; |
121 | 121 | try { |
122 | 122 | $dump = $this->tpl->render($tpl, $vars); |
123 | - } catch (\Exception $e) { |
|
123 | + }catch (\Exception $e) { |
|
124 | 124 | Logger::log($e->getMessage(), LOG_ERR); |
125 | 125 | } |
126 | 126 | return $dump; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public function regenerateTemplates() |
148 | 148 | { |
149 | 149 | $this->generateTemplatesCache(); |
150 | - $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true); |
|
150 | + $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true); |
|
151 | 151 | $translations = []; |
152 | 152 | if (is_array($domains)) { |
153 | 153 | $translations = $this->parsePathTranslations($domains); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | // force compilation |
173 | 173 | if ($file->isFile()) { |
174 | 174 | try { |
175 | - $this->tpl->load(str_replace($tplDir . '/', '', $file)); |
|
176 | - } catch (\Exception $e) { |
|
175 | + $this->tpl->load(str_replace($tplDir.'/', '', $file)); |
|
176 | + }catch (\Exception $e) { |
|
177 | 177 | Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]); |
178 | 178 | } |
179 | 179 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | private function loadDomains() |
255 | 255 | { |
256 | - $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true); |
|
256 | + $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true); |
|
257 | 257 | if (null !== $domains) { |
258 | 258 | foreach ($domains as $domain => $paths) { |
259 | 259 | $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain)); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | $loader = new FilesystemLoader(GeneratorHelper::getTemplatePath()); |
270 | 270 | $this->tpl = new Environment($loader, array( |
271 | - 'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig', |
|
271 | + 'cache' => CACHE_DIR.DIRECTORY_SEPARATOR.'twig', |
|
272 | 272 | 'debug' => (bool)$this->debug, |
273 | 273 | 'auto_reload' => Config::getParam('twig.autoreload', TRUE), |
274 | 274 | )); |
@@ -23,10 +23,10 @@ discard block |
||
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 |
||
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 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | { |
62 | 62 | try { |
63 | 63 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
64 | - throw new \Exception(t('Can\'t create directory ') . $dir); |
|
64 | + throw new \Exception(t('Can\'t create directory ').$dir); |
|
65 | 65 | } |
66 | - } catch (\Exception $e) { |
|
66 | + }catch (\Exception $e) { |
|
67 | 67 | syslog(LOG_WARNING, $e->getMessage()); |
68 | 68 | if (!file_exists(dirname($dir))) { |
69 | - throw new GeneratorException($e->getMessage() . $dir); |
|
69 | + throw new GeneratorException($e->getMessage().$dir); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function getTemplatePath() |
79 | 79 | { |
80 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
80 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
81 | 81 | return realpath($path); |
82 | 82 | } |
83 | 83 | |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | * @throws \ReflectionException |
97 | 97 | */ |
98 | 98 | public static function checkCustomNamespaceApi($namespace) { |
99 | - if(!empty($namespace)) { |
|
100 | - if(class_exists($namespace)) { |
|
99 | + if (!empty($namespace)) { |
|
100 | + if (class_exists($namespace)) { |
|
101 | 101 | $reflector = new \ReflectionClass($namespace); |
102 | - if(!$reflector->isSubclassOf(Api::class)) { |
|
102 | + if (!$reflector->isSubclassOf(Api::class)) { |
|
103 | 103 | throw new GeneratorException(t('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501); |
104 | - } elseif(!$reflector->isAbstract()) { |
|
104 | + } elseif (!$reflector->isAbstract()) { |
|
105 | 105 | throw new GeneratorException(t('La clase definida debe ser abstracta'), 501); |
106 | 106 | } |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | throw new GeneratorException(t('La clase definida para extender la API no existe'), 501); |
109 | 109 | } |
110 | 110 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public static function createRoot($path = WEB_DIR, OutputInterface $output = null, $quiet = false) { |
120 | 120 | |
121 | - if(null === $output) { |
|
121 | + if (null === $output) { |
|
122 | 122 | $output = new ConsoleOutput(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | GeneratorHelper::createDir($path); |
126 | 126 | $paths = array("js", "css", "img", "media", "font"); |
127 | 127 | foreach ($paths as $htmlPath) { |
128 | - GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
128 | + GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Generates the root needed files |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | ]; |
139 | 139 | $output->writeln('Start creating html files'); |
140 | 140 | foreach ($files as $templates => $filename) { |
141 | - $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig'); |
|
142 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
143 | - if(!$quiet) { |
|
144 | - $output->writeln('Can\t create the file ' . $filename); |
|
141 | + $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig'); |
|
142 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
143 | + if (!$quiet) { |
|
144 | + $output->writeln('Can\t create the file '.$filename); |
|
145 | 145 | } |
146 | - } else { |
|
147 | - if(!$quiet) { |
|
148 | - $output->writeln($filename . ' created successfully'); |
|
146 | + }else { |
|
147 | + if (!$quiet) { |
|
148 | + $output->writeln($filename.' created successfully'); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | //Export base locale translations |
154 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
155 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
156 | - self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
154 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
155 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
156 | + self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | { |
170 | 170 | if (file_exists($filenamePath)) { |
171 | 171 | $destfolder = basename($filenamePath); |
172 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
172 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
173 | 173 | if (is_dir($filenamePath)) { |
174 | - self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
175 | - } else { |
|
176 | - if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
177 | - throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
174 | + self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
175 | + }else { |
|
176 | + if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
177 | + throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | } |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | self::createDir($dst); |
193 | 193 | while (false !== ($file = readdir($dir))) { |
194 | 194 | if (($file != '.') && ($file != '..')) { |
195 | - if (is_dir($src . '/' . $file)) { |
|
196 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
197 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
198 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
195 | + if (is_dir($src.'/'.$file)) { |
|
196 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
197 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
198 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -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'></script>\n"; |
|
26 | + }else { |
|
27 | + echo "\t\t<script type='text/javascript' src='".$baseUrl."/js/".$hash.".js'></script>\n"; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function putDebugJs($pathParts, $base, $file, $hash, array &$compiledFiles) |
41 | 41 | { |
42 | - $filePath = $hash . "_" . $pathParts[count($pathParts) - 1]; |
|
43 | - $compiledFiles[] = "/js/" . $filePath; |
|
42 | + $filePath = $hash."_".$pathParts[count($pathParts) - 1]; |
|
43 | + $compiledFiles[] = "/js/".$filePath; |
|
44 | 44 | $data = ""; |
45 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file)) { |
|
45 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file)) { |
|
46 | 46 | $data = file_get_contents($file); |
47 | - AssetsHelper::storeContents($base . $filePath, $data); |
|
47 | + AssetsHelper::storeContents($base.$filePath, $data); |
|
48 | 48 | } |
49 | 49 | return $data; |
50 | 50 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | protected function compileJs(array $files, $basePath, $hash, array &$compiledFiles) |
62 | 62 | { |
63 | - $base = $basePath . "js" . DIRECTORY_SEPARATOR; |
|
63 | + $base = $basePath."js".DIRECTORY_SEPARATOR; |
|
64 | 64 | $debug = Config::getParam('debug'); |
65 | - if ($debug || !file_exists($base . $hash . ".js")) { |
|
65 | + if ($debug || !file_exists($base.$hash.".js")) { |
|
66 | 66 | $data = ''; |
67 | 67 | if (0 < count($files)) { |
68 | 68 | $minifier = new JS(); |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | if (file_exists($file)) { |
72 | 72 | if ($debug) { |
73 | 73 | $data = $this->putDebugJs($pathParts, $base, $file, $hash, $compiledFiles); |
74 | - } elseif (!file_exists($base . $hash . ".js")) { |
|
74 | + } elseif (!file_exists($base.$hash.".js")) { |
|
75 | 75 | $minifier->add($file); |
76 | 76 | //$data = $this->putProductionJs($base, $file, $data); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
80 | - if($debug) { |
|
81 | - AssetsHelper::storeContents($base . $hash . ".js", $data); |
|
82 | - } else { |
|
80 | + if ($debug) { |
|
81 | + AssetsHelper::storeContents($base.$hash.".js", $data); |
|
82 | + }else { |
|
83 | 83 | $this->dumpJs($hash, $base, $minifier); |
84 | 84 | } |
85 | 85 | unset($minifier); |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | ini_set('memory_limit', -1); |
101 | 101 | GeneratorHelper::createDir($base); |
102 | 102 | if (Config::getParam('assets.obfuscate', false)) { |
103 | - $minifier->gzip($base . $hash . ".js"); |
|
104 | - } else { |
|
105 | - $minifier->minify($base . $hash . ".js"); |
|
103 | + $minifier->gzip($base.$hash.".js"); |
|
104 | + }else { |
|
105 | + $minifier->minify($base.$hash.".js"); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |