@@ -72,8 +72,9 @@ |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public function setCallable($callback) { |
75 | - if (is_callable($callback)) |
|
76 | - $this->callable = $callback; |
|
75 | + if (is_callable($callback)) { |
|
76 | + $this->callable = $callback; |
|
77 | + } |
|
77 | 78 | } |
78 | 79 | |
79 | 80 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | private $argsPattern = "(\\w+)"; |
62 | 62 | |
63 | 63 | public function __construct($pattern, $callable) { |
64 | - $this->argsPattern = self::PARAMETER_CHARACTER . $this->argsPattern; |
|
64 | + $this->argsPattern = self::PARAMETER_CHARACTER.$this->argsPattern; |
|
65 | 65 | $this->setPattern($pattern); |
66 | 66 | $this->setCallable($callable); |
67 | 67 | $this->filterPattern(); |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | $pattern = $this->getPattern(); |
72 | 72 | $match = []; |
73 | 73 | $pattern = str_replace("/", "\\/", $pattern); |
74 | - if (preg_match_all("/" . $this->argsPattern . "/", $pattern, $match)) { |
|
74 | + if (preg_match_all("/".$this->argsPattern."/", $pattern, $match)) { |
|
75 | 75 | $strings = $match[0]; |
76 | 76 | $parameters = $match[1]; |
77 | 77 | $this->params = $parameters; |
78 | 78 | $pattern = str_replace($strings, str_replace(self::PARAMETER_CHARACTER, "", $this->argsPattern), $pattern); |
79 | 79 | } |
80 | - $this->setPattern("/^" . $pattern . "$/"); |
|
80 | + $this->setPattern("/^".$pattern."$/"); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function setPattern($pattern) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // Get the substring after $substrToRemove |
54 | 54 | $post = substr($string, $lastIndex); |
55 | 55 | // Return $pre and $post |
56 | - return $pre . $post; |
|
56 | + return $pre.$post; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public static function addTrailingSlash($path) { |
78 | 78 | if (null !== $path && is_string($path) && !empty($path)) { |
79 | 79 | if (substr($path, -1) !== "/") { |
80 | - $path .="/"; |
|
80 | + $path .= "/"; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | return $path; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return string |
102 | 102 | */ |
103 | 103 | public static function removeDouble($string, $substring) { |
104 | - return str_replace($substring . $substring, $substring, $string); |
|
104 | + return str_replace($substring.$substring, $substring, $string); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function testUtilsAddTrailingSlash() { |
74 | 74 | $path = "/etc/php5"; |
75 | 75 | $this->assertEquals("/etc/php5/", Utils::addTrailingSlash($path)); |
76 | - $this->assertEquals("/etc/php5/", Utils::addTrailingSlash($path . "/")); |
|
76 | + $this->assertEquals("/etc/php5/", Utils::addTrailingSlash($path."/")); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $pathUnx = "/var/htdocs"; |
85 | 85 | $this->assertEquals("C:/php/ext/", Utils::filterPath($pathWin)); |
86 | 86 | $this->assertEquals("/var/htdocs/", Utils::filterPath($pathUnx)); |
87 | - $this->assertEquals("/var/htdocs/", Utils::filterPath($pathUnx . "/")); |
|
87 | + $this->assertEquals("/var/htdocs/", Utils::filterPath($pathUnx."/")); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | private $module; |
63 | 63 | |
64 | 64 | public function setUp() { |
65 | - $valuesFile_en = self::$resourceFolder . "/values.json"; |
|
66 | - $valuesFile_es = self::$resourceFolder . "/values_es.json"; |
|
67 | - $valuesFile_fr = self::$resourceFolder . "/values_fr.json"; |
|
65 | + $valuesFile_en = self::$resourceFolder."/values.json"; |
|
66 | + $valuesFile_es = self::$resourceFolder."/values_es.json"; |
|
67 | + $valuesFile_fr = self::$resourceFolder."/values_fr.json"; |
|
68 | 68 | if (!is_dir(self::$resourceFolder)) { |
69 | 69 | mkdir(self::$resourceFolder); |
70 | 70 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | file_put_contents($valuesFile_fr, json_encode($this->locale_fr)); |
79 | 79 | } |
80 | 80 | $this->config = [ |
81 | - "resourceFolder" => "./" . self::$resourceFolder . "/" |
|
81 | + "resourceFolder" => "./".self::$resourceFolder."/" |
|
82 | 82 | ]; |
83 | 83 | $this->module = new \Tight\Modules\Localize\Localize($this->config); |
84 | 84 | } |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | <body> |
181 | 181 | <h1>Tight Framework Exception</h1> |
182 | 182 | EXC; |
183 | - $output .= "<p><strong>" . get_class($exception) . ": </strong>" . $exception->getMessage() . "</p>"; |
|
184 | - $output .= "<p class='padding-left'>in <strong>" . $lastTrace['file'] . "</strong> at line <strong>" . $lastTrace['line'] . "</strong></p>"; |
|
183 | + $output .= "<p><strong>".get_class($exception).": </strong>".$exception->getMessage()."</p>"; |
|
184 | + $output .= "<p class='padding-left'>in <strong>".$lastTrace['file']."</strong> at line <strong>".$lastTrace['line']."</strong></p>"; |
|
185 | 185 | $output .= "<br/>"; |
186 | 186 | $output .= "<p>Stack Trace:</p>"; |
187 | 187 | $trace = $exception->getTrace(); |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | $class = isset($element["class"]) ? $element["class"] : ""; |
192 | 192 | $type = isset($element["type"]) ? $element["type"] : ""; |
193 | 193 | $func = isset($element["function"]) ? $element["function"] : ""; |
194 | - $file = isset($element["file"]) ? "at <strong>" . $element["file"] . "</strong>" : ""; |
|
195 | - $line = isset($element["line"]) ? " at line <strong>" . $element["line"] . "</strong>" : ""; |
|
196 | - $output .= "<p>#" . ($index + 1) . ": " . $class . $type . $func . "() " . $file . $line . "</strong></p>"; |
|
194 | + $file = isset($element["file"]) ? "at <strong>".$element["file"]."</strong>" : ""; |
|
195 | + $line = isset($element["line"]) ? " at line <strong>".$element["line"]."</strong>" : ""; |
|
196 | + $output .= "<p>#".($index + 1).": ".$class.$type.$func."() ".$file.$line."</strong></p>"; |
|
197 | 197 | } |
198 | 198 | echo $output; |
199 | 199 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @covers Tight\Router::__construct |
41 | 41 | */ |
42 | 42 | public function setUp() { |
43 | - $dirs = ["models","views","controllers"]; |
|
43 | + $dirs = ["models", "views", "controllers"]; |
|
44 | 44 | $size = count($dirs); |
45 | 45 | for ($index = 0; $index < $size; $index++) { |
46 | - if(!is_dir($dirs[$index])){ |
|
46 | + if (!is_dir($dirs[$index])) { |
|
47 | 47 | mkdir($dirs[$index]); |
48 | 48 | } |
49 | 49 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | return "Hello"; |
53 | 53 | }); |
54 | 54 | $this->router->get("/hello/:id", function($id) { |
55 | - return "Hello " . $id; |
|
55 | + return "Hello ".$id; |
|
56 | 56 | }); |
57 | 57 | $this->router->post("/world/", function() { |
58 | 58 | return "world"; |
59 | 59 | }); |
60 | 60 | $this->router->post("/world/:id", function($id) { |
61 | - return $id . " world"; |
|
61 | + return $id." world"; |
|
62 | 62 | }); |
63 | 63 | $this->router->map(["get", "post"], "/map/", function() { |
64 | 64 | return "map"; |
@@ -107,7 +107,7 @@ |
||
107 | 107 | unset($app); |
108 | 108 | $app = new \Tight\Tight; |
109 | 109 | $app->setConfig($this->config); |
110 | - $this->assertEquals($expectedClass,$app->getConfig()); |
|
110 | + $this->assertEquals($expectedClass, $app->getConfig()); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -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"); |
66 | 66 | $this->setConfig($config); |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | public function setLocale($locale) { |
124 | 124 | $this->locale = $locale; |
125 | 125 | $folder = \Tight\Utils::addTrailingSlash($this->getConfig()->resourceFolder); |
126 | - $fileName = $this->getConfig()->resourceFileName . $this->getConfig()->langSeparator . $locale . "." . $this->getConfig()->resourceFileType; |
|
127 | - $file = $folder . $fileName; |
|
126 | + $fileName = $this->getConfig()->resourceFileName.$this->getConfig()->langSeparator.$locale.".".$this->getConfig()->resourceFileType; |
|
127 | + $file = $folder.$fileName; |
|
128 | 128 | if (is_file($file)) { |
129 | 129 | $this->values = json_decode(file_get_contents($file), JSON_FORCE_OBJECT); |
130 | 130 | } else { |
131 | - $fileName = $this->getConfig()->resourceFileName . "." . $this->getConfig()->resourceFileType; |
|
132 | - $file = $folder . $fileName; |
|
131 | + $fileName = $this->getConfig()->resourceFileName.".".$this->getConfig()->resourceFileType; |
|
132 | + $file = $folder.$fileName; |
|
133 | 133 | if (is_file($file)) { |
134 | 134 | $this->values = json_decode(file_get_contents($file), JSON_FORCE_OBJECT); |
135 | 135 | } else { |
136 | - throw new \Tight\Modules\ModuleException("Resource file <strong>" . $file . "</strong> not found"); |
|
136 | + throw new \Tight\Modules\ModuleException("Resource file <strong>".$file."</strong> not found"); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | } |
156 | 156 | foreach ($files as $element) { |
157 | - $file = \Tight\Utils::getSlicedFile($directory . $element); |
|
157 | + $file = \Tight\Utils::getSlicedFile($directory.$element); |
|
158 | 158 | //Removes extension |
159 | 159 | $name = $file["name"]; |
160 | 160 | $explode = explode($this->getConfig()->langSeparator, $name); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | if (!isset($this->modules[$module->getModuleName()])) { |
62 | 62 | $this->modules[$module->getModuleName()] = $module; |
63 | 63 | } else { |
64 | - throw new \Tight\Modules\ModuleException("Module <strong>" . $module->getModuleName() . "</strong> already exists"); |
|
64 | + throw new \Tight\Modules\ModuleException("Module <strong>".$module->getModuleName()."</strong> already exists"); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 |