@@ -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 | } |
@@ -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 | /** |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $this->modules[$module->getModuleName()] = $module; |
| 63 | 63 | $module->onLoad(); |
| 64 | 64 | } else { |
| 65 | - throw new \Tight\Exception\ModuleException("Module <strong>" . $module->getModuleName() . "</strong> already exists"); |
|
| 65 | + throw new \Tight\Exception\ModuleException("Module <strong>".$module->getModuleName()."</strong> already exists"); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -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 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * @test |
| 111 | 111 | */ |
| 112 | - public function testUtilsStartsWith(){ |
|
| 112 | + public function testUtilsStartsWith() { |
|
| 113 | 113 | $string = "abcd"; |
| 114 | 114 | $this->assertTrue(Utils::startsWith("abcd", "abc")); |
| 115 | 115 | $this->assertFalse(Utils::startsWith("abcd", "cd")); |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | private $module; |
| 92 | 92 | |
| 93 | 93 | public function setUp() { |
| 94 | - $valuesFile_en = self::$resourceFolder . "/values.json"; |
|
| 95 | - $valuesFile_es = self::$resourceFolder . "/values_es.json"; |
|
| 96 | - $valuesFile_fr = self::$resourceFolder . "/values_fr.json"; |
|
| 97 | - $valuesXml = self::$resourceFolder . "/values.xml"; |
|
| 94 | + $valuesFile_en = self::$resourceFolder."/values.json"; |
|
| 95 | + $valuesFile_es = self::$resourceFolder."/values_es.json"; |
|
| 96 | + $valuesFile_fr = self::$resourceFolder."/values_fr.json"; |
|
| 97 | + $valuesXml = self::$resourceFolder."/values.xml"; |
|
| 98 | 98 | if (!is_dir(self::$resourceFolder)) { |
| 99 | 99 | mkdir(self::$resourceFolder); |
| 100 | 100 | } |
@@ -111,16 +111,16 @@ discard block |
||
| 111 | 111 | file_put_contents($valuesXml, $this->valuesXml); |
| 112 | 112 | } |
| 113 | 113 | $this->config = [ |
| 114 | - "resourceFolder" => "./" . self::$resourceFolder . "/" |
|
| 114 | + "resourceFolder" => "./".self::$resourceFolder."/" |
|
| 115 | 115 | ]; |
| 116 | 116 | $this->module = new \Tight\Modules\Localize\Localize($this->config); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function tearDown() { |
| 120 | - $valuesFile_en = self::$resourceFolder . "/values.json"; |
|
| 121 | - $valuesFile_es = self::$resourceFolder . "/values_es.json"; |
|
| 122 | - $valuesFile_fr = self::$resourceFolder . "/values_fr.json"; |
|
| 123 | - $valuesXml = self::$resourceFolder . "/values.xml"; |
|
| 120 | + $valuesFile_en = self::$resourceFolder."/values.json"; |
|
| 121 | + $valuesFile_es = self::$resourceFolder."/values_es.json"; |
|
| 122 | + $valuesFile_fr = self::$resourceFolder."/values_fr.json"; |
|
| 123 | + $valuesXml = self::$resourceFolder."/values.xml"; |
|
| 124 | 124 | $files = [$valuesFile_en, $valuesFile_es, $valuesFile_fr, $valuesXml]; |
| 125 | 125 | $size = count($files); |
| 126 | 126 | for ($index = 0; $index < $size; $index++) { |
@@ -55,14 +55,14 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * @test |
| 57 | 57 | */ |
| 58 | - public function testAbstractModuleGetVersion(){ |
|
| 58 | + public function testAbstractModuleGetVersion() { |
|
| 59 | 59 | $this->assertEquals($this->version, $this->module->getModuleVersion()); |
| 60 | 60 | } |
| 61 | 61 | /** |
| 62 | 62 | * @test |
| 63 | 63 | */ |
| 64 | - public function testAbstractModuleGetAppConfig(){ |
|
| 65 | - $this->assertEquals(\Tight\Tight::getInstance()->getConfig(),$this->module->getAppConfig()); |
|
| 64 | + public function testAbstractModuleGetAppConfig() { |
|
| 65 | + $this->assertEquals(\Tight\Tight::getInstance()->getConfig(), $this->module->getAppConfig()); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |