@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if (is_array($config)) { |
61 | 61 | $config = new \Tight\Modules\Localize\LocalizeConfig($config); |
62 | 62 | } else if (!$config instanceof \Tight\Modules\Localize\LocalizeConfig) { |
63 | - throw new \InvalidArgumentException("Argument 1 passed to " . get_class($this) . " must be an array or an instance of Tight\Modules\Localize\LocalizeConfig"); |
|
63 | + throw new \InvalidArgumentException("Argument 1 passed to ".get_class($this)." must be an array or an instance of Tight\Modules\Localize\LocalizeConfig"); |
|
64 | 64 | } |
65 | 65 | parent::__construct("LocalizeModule", "v1.2"); |
66 | 66 | $this->setConfig($config); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | foreach ($files as $element) { |
174 | - $file = \Tight\Utils::getSlicedFile($directory . $element); |
|
174 | + $file = \Tight\Utils::getSlicedFile($directory.$element); |
|
175 | 175 | //Removes extension |
176 | 176 | $name = $file["name"]; |
177 | 177 | $explode = explode($this->getConfig()->langSeparator, $name); |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | private function getValuesFromJson() { |
196 | 196 | $output = []; |
197 | 197 | $folder = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder); |
198 | - $fileName = $this->getConfig()->resourceFileName . $this->getConfig()->langSeparator . $this->locale . "." . $this->getConfig()->resourceFileType; |
|
199 | - $file = $folder . $fileName; |
|
198 | + $fileName = $this->getConfig()->resourceFileName.$this->getConfig()->langSeparator.$this->locale.".".$this->getConfig()->resourceFileType; |
|
199 | + $file = $folder.$fileName; |
|
200 | 200 | if (is_file($file)) { |
201 | 201 | $output = json_decode(file_get_contents($file), JSON_FORCE_OBJECT); |
202 | 202 | } else { |
203 | - $fileName = $this->getConfig()->resourceFileName . "." . $this->getConfig()->resourceFileType; |
|
204 | - $file = $folder . $fileName; |
|
203 | + $fileName = $this->getConfig()->resourceFileName.".".$this->getConfig()->resourceFileType; |
|
204 | + $file = $folder.$fileName; |
|
205 | 205 | if (is_file($file)) { |
206 | 206 | $output = json_decode(file_get_contents($file), JSON_FORCE_OBJECT); |
207 | 207 | } else { |
208 | - throw new \Tight\Exception\ModuleException("Resource file <strong>" . $file . "</strong> not found"); |
|
208 | + throw new \Tight\Exception\ModuleException("Resource file <strong>".$file."</strong> not found"); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | return $output; |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | private function getXmlResources() { |
234 | 234 | $output = null; |
235 | 235 | if ($this->resourceFileType === LocalizeConfig::FILETYPE_XML) { |
236 | - $file = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder) . $this->getConfig()->resourceFileName . "." . $this->resourceFileType; |
|
236 | + $file = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder).$this->getConfig()->resourceFileName.".".$this->resourceFileType; |
|
237 | 237 | if (is_file($file)) { |
238 | 238 | $xmlContent = file_get_contents($file); |
239 | 239 | $output = new \SimpleXMLElement($xmlContent); |
240 | 240 | } else { |
241 | - throw new \Tight\Exception\ModuleException("Resource file <strong>" . $file . "</strong> does not exists"); |
|
241 | + throw new \Tight\Exception\ModuleException("Resource file <strong>".$file."</strong> does not exists"); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | return $output; |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | $index++; |
264 | 264 | } |
265 | 265 | if (null == $locale) { |
266 | - $fileName = $this->getConfig()->resourceFileName . "." . $this->getConfig()->resourceFileType; |
|
267 | - throw new \Tight\Exception\ModuleException("Locale <strong>" . $this->locale . "</strong> not found at resource file <strong>" . $fileName . "</strong>"); |
|
266 | + $fileName = $this->getConfig()->resourceFileName.".".$this->getConfig()->resourceFileType; |
|
267 | + throw new \Tight\Exception\ModuleException("Locale <strong>".$this->locale."</strong> not found at resource file <strong>".$fileName."</strong>"); |
|
268 | 268 | } |
269 | 269 | return $this->parseXmlStringValues($locale); |
270 | 270 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if (null !== $basePath && is_string($basePath) && !empty($basePath)) { |
81 | 81 | $basePath = Utils::filterPath($basePath); |
82 | 82 | if (Utils::inString($basePath, $_SERVER['DOCUMENT_ROOT'])) { |
83 | - $this->basePath = Utils::removeDouble("/".Utils::removeSubstring($basePath, $_SERVER['DOCUMENT_ROOT']),"/"); |
|
83 | + $this->basePath = Utils::removeDouble("/".Utils::removeSubstring($basePath, $_SERVER['DOCUMENT_ROOT']), "/"); |
|
84 | 84 | } else { |
85 | 85 | $this->basePath = $basePath; |
86 | 86 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | $pattern = array_shift($args); // 1st index-> Pattern |
173 | 173 | $callable = array_pop($args); // Last index-> callable |
174 | - $route = new Route(Utils::removeDouble($this->basePath . $pattern, "/"), $callable); |
|
174 | + $route = new Route(Utils::removeDouble($this->basePath.$pattern, "/"), $callable); |
|
175 | 175 | $route->setHttpMethods($methods); |
176 | 176 | if (count($args) > 0) { |
177 | 177 | // Adds the middleware |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @return string Request URN |
248 | 248 | */ |
249 | 249 | public function getRequestUrn() { |
250 | - $output = Utils::addTrailingSlash("/" . Utils::removeSubstring($_SERVER['REQUEST_URI'], $this->basePath)); |
|
250 | + $output = Utils::addTrailingSlash("/".Utils::removeSubstring($_SERVER['REQUEST_URI'], $this->basePath)); |
|
251 | 251 | return $output; |
252 | 252 | } |
253 | 253 | |
@@ -265,22 +265,22 @@ discard block |
||
265 | 265 | $viewDir = $config->mvc["view_dir"]; |
266 | 266 | if (is_dir($controllerDir) && is_dir($modelDir) && is_dir($viewDir)) { |
267 | 267 | if (strpos(strtolower($className), "controller") !== FALSE) { |
268 | - if (is_file($controllerDir . $className . ".php")) { |
|
269 | - require_once $controllerDir . $className . ".php"; |
|
268 | + if (is_file($controllerDir.$className.".php")) { |
|
269 | + require_once $controllerDir.$className.".php"; |
|
270 | 270 | } else { |
271 | - $fileNotFound = $controllerDir . $className . ".php"; |
|
271 | + $fileNotFound = $controllerDir.$className.".php"; |
|
272 | 272 | } |
273 | 273 | } elseif (strpos(strtolower($className), "model") !== FALSE) { |
274 | - if (is_file($modelDir . $className . ".php")) { |
|
275 | - require_once $modelDir . $className . ".php"; |
|
274 | + if (is_file($modelDir.$className.".php")) { |
|
275 | + require_once $modelDir.$className.".php"; |
|
276 | 276 | } else { |
277 | - $fileNotFound = $modelDir . $className . ".php"; |
|
277 | + $fileNotFound = $modelDir.$className.".php"; |
|
278 | 278 | } |
279 | 279 | } elseif (strpos(strtolower($className), "view") !== FALSE) { |
280 | - if (is_file($viewDir . $className . ".php")) { |
|
281 | - require_once $viewDir . $className . ".php"; |
|
280 | + if (is_file($viewDir.$className.".php")) { |
|
281 | + require_once $viewDir.$className.".php"; |
|
282 | 282 | } else { |
283 | - $fileNotFound = $viewDir . $className . ".php"; |
|
283 | + $fileNotFound = $viewDir.$className.".php"; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } else { |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $err = !is_dir($controllerDir) ? "Controller directory not found" : (!is_dir($modelDir) ? "Model directory not found" : "View directory not found"); |
291 | 291 | throw new \Tight\Exception\RouterException($err); |
292 | 292 | } else if ($fileNotFound !== false) { |
293 | - $err = "File <strong>" . $fileNotFound . "</strong> not found"; |
|
293 | + $err = "File <strong>".$fileNotFound."</strong> not found"; |
|
294 | 294 | throw new \Tight\Exception\NotFoundException($err); |
295 | 295 | } |
296 | 296 | } |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | } |
317 | 317 | } |
318 | 318 | $name = ucwords($name); |
319 | - $contName = $name . "Controller"; |
|
320 | - $viewName = $name . "View"; |
|
321 | - $modName = $name . "Model"; |
|
319 | + $contName = $name."Controller"; |
|
320 | + $viewName = $name."View"; |
|
321 | + $modName = $name."Model"; |
|
322 | 322 | $model = new $modName(); |
323 | 323 | $view = new $viewName(); |
324 | 324 | $controller = new $contName($model, $view); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | if (method_exists($controller, $method)) { |
327 | 327 | call_user_method_array($method, $controller, $args); |
328 | 328 | } else { |
329 | - throw new \Tight\Exception\RouterException("Method <strong>" . $method . "</strong> not defined for <strong>" . $contName . "</strong> class"); |
|
329 | + throw new \Tight\Exception\RouterException("Method <strong>".$method."</strong> not defined for <strong>".$contName."</strong> class"); |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | $controller->render(); |