@@ -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 | /** |
@@ -58,6 +58,9 @@ |
||
| 58 | 58 | protected $pattern = ""; |
| 59 | 59 | protected $callable; |
| 60 | 60 | |
| 61 | + /** |
|
| 62 | + * @param string $pattern |
|
| 63 | + */ |
|
| 61 | 64 | public function __construct($pattern, $callable) { |
| 62 | 65 | $this->setPattern($pattern); |
| 63 | 66 | $this->setCallable($callable); |
@@ -36,8 +36,9 @@ |
||
| 36 | 36 | |
| 37 | 37 | public static function removeSubstring($string, $substrToRemove) { |
| 38 | 38 | $firstIndex = strpos($string, $substrToRemove); |
| 39 | - if ($firstIndex === FALSE) |
|
| 40 | - return $string; |
|
| 39 | + if ($firstIndex === FALSE) { |
|
| 40 | + return $string; |
|
| 41 | + } |
|
| 41 | 42 | $lastIndex = $firstIndex + strlen($substrToRemove); |
| 42 | 43 | $pre = substr($string, 0, $firstIndex); |
| 43 | 44 | $post = substr($string, $lastIndex); |
@@ -48,10 +48,12 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function __construct($config = []) { |
| 50 | 50 | set_exception_handler([$this, "exceptionHandler"]); |
| 51 | - if (is_array($config)) |
|
| 52 | - $config = new \Tight\TightConfig($config); |
|
| 53 | - if (!$config instanceof \Tight\TightConfig) |
|
| 54 | - throw new \InvalidArgumentException("Argument passed to Tight::__constructor must be array or <b>\Tight\TightConfig</b> object"); |
|
| 51 | + if (is_array($config)) { |
|
| 52 | + $config = new \Tight\TightConfig($config); |
|
| 53 | + } |
|
| 54 | + if (!$config instanceof \Tight\TightConfig) { |
|
| 55 | + throw new \InvalidArgumentException("Argument passed to Tight::__constructor must be array or <b>\Tight\TightConfig</b> object"); |
|
| 56 | + } |
|
| 55 | 57 | $this->config = $config; |
| 56 | 58 | $this->router = new Router($config->basePath); |
| 57 | 59 | } |
@@ -44,10 +44,11 @@ |
||
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | public function __get($name) { |
| 47 | - if(isset($this->config[$name])) |
|
| 48 | - return $this->config[$name]; |
|
| 49 | - else |
|
| 50 | - return null; |
|
| 47 | + if(isset($this->config[$name])) { |
|
| 48 | + return $this->config[$name]; |
|
| 49 | + } else { |
|
| 50 | + return null; |
|
| 51 | + } |
|
| 51 | 52 | } |
| 52 | 53 | public function __set($name, $value) { |
| 53 | 54 | $this->config[$name] = $value; |