@@ -158,7 +158,7 @@ |
||
| 158 | 158 | /** |
| 159 | 159 | * Get form error by input field |
| 160 | 160 | * @param $field |
| 161 | - * @return bool|string |
|
| 161 | + * @return string|false |
|
| 162 | 162 | */ |
| 163 | 163 | public function getFormError($field) |
| 164 | 164 | { |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | public function render(string $template = "", array $variables = []) |
| 56 | 56 | { |
| 57 | 57 | $view = new ViewController(); |
| 58 | - $view->setTemplate( $template ); |
|
| 59 | - $view->setVariables( $variables ); |
|
| 58 | + $view->setTemplate($template); |
|
| 59 | + $view->setVariables($variables); |
|
| 60 | 60 | return $view->render(); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -101,10 +101,10 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function renderBlock(string $name, string $default = "") |
| 103 | 103 | { |
| 104 | - if($this->view->getVariable($name) == null) { |
|
| 104 | + if ($this->view->getVariable($name) == null) { |
|
| 105 | 105 | return $default; |
| 106 | 106 | } |
| 107 | - return trim($this->view->getVariable( $name )); |
|
| 107 | + return trim($this->view->getVariable($name)); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function escape(string $string) |
| 116 | 116 | { |
| 117 | - return stripslashes( strip_tags( $string ) ); |
|
| 117 | + return stripslashes(strip_tags($string)); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $files = $this->view->getVariable('assets'.ucfirst($type)); |
|
| 142 | + $files = $this->view->getVariable('assets' . ucfirst($type)); |
|
| 143 | 143 | |
| 144 | 144 | foreach ($files AS $file) { |
| 145 | - $result .= sprintf($pattern, $file). "\n"; |
|
| 145 | + $result .= sprintf($pattern, $file) . "\n"; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $result; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | if ($routeName === $name) { |
| 222 | 222 | |
| 223 | - $path = preg_replace('|/\((.*)\)|', '', $data['path']);; |
|
| 223 | + $path = preg_replace('|/\((.*)\)|', '', $data['path']); ; |
|
| 224 | 224 | break; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | /** |
| 108 | 108 | * Get a single variable |
| 109 | 109 | * @param $key |
| 110 | - * @return boolean|string|array |
|
| 110 | + * @return string |
|
| 111 | 111 | */ |
| 112 | 112 | public function getVariable(string $key) |
| 113 | 113 | { |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | * Holds the view variables |
| 25 | 25 | * @var array |
| 26 | 26 | */ |
| 27 | - private $variable = []; |
|
| 27 | + private $variable = []; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Holds the view template |
| 31 | 31 | * @var string |
| 32 | 32 | */ |
| 33 | - private $template = ""; |
|
| 33 | + private $template = ""; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Holds the parent template |
| 37 | 37 | * @var ViewController |
| 38 | 38 | */ |
| 39 | - private $extendedTemplate = null; |
|
| 39 | + private $extendedTemplate = null; |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Set template for this view |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getTemplate() |
| 93 | 93 | { |
| 94 | - return (string) $this->template; |
|
| 94 | + return (string)$this->template; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getVariable(string $key) |
| 113 | 113 | { |
| 114 | - if(isset($this->variable[$key])) { |
|
| 114 | + if (isset($this->variable[$key])) { |
|
| 115 | 115 | return $this->variable[$key]; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function hasVariable(string $key) |
| 127 | 127 | { |
| 128 | - if(isset($this->variable[$key])) { |
|
| 128 | + if (isset($this->variable[$key])) { |
|
| 129 | 129 | return true; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function setVariables(array $variables = []) |
| 141 | 141 | { |
| 142 | - foreach($variables AS $key=>$value) { |
|
| 142 | + foreach ($variables AS $key=>$value) { |
|
| 143 | 143 | $this->setVariable($key, $value); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | ob_end_clean(); |
| 204 | 204 | |
| 205 | - if( $this->getExtendedTemplate() instanceof ViewController ) { |
|
| 205 | + if ($this->getExtendedTemplate() instanceof ViewController) { |
|
| 206 | 206 | return $this->cleanOutput($this->getExtendedTemplate()->setVariables($this->getVariables())->render()); |
| 207 | 207 | } else { |
| 208 | 208 | return $this->cleanOutput($content); |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function __destruct() |
| 253 | 253 | { |
| 254 | - unset( $this->variable ); |
|
| 255 | - unset( $this->template ); |
|
| 254 | + unset($this->variable); |
|
| 255 | + unset($this->template); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | \ No newline at end of file |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | if (in_array($code, array_keys(Response::HTTP_STATUS_CODES))) { |
| 29 | 29 | |
| 30 | 30 | header('HTTP/2 ' . $code . ' ' . Response::HTTP_STATUS_CODES[$code]); |
| 31 | - header('Location: ' . $location); |
|
| 31 | + header('Location: ' . $location); |
|
| 32 | 32 | return $this->terminate(); |
| 33 | 33 | |
| 34 | 34 | } |
@@ -10,10 +10,8 @@ |
||
| 10 | 10 | use Faulancer\Exception\ClassNotFoundException; |
| 11 | 11 | use Faulancer\Exception\DispatchFailureException; |
| 12 | 12 | use Faulancer\Form\AbstractFormHandler; |
| 13 | -use Faulancer\Helper\Reflection\AnnotationParser; |
|
| 14 | 13 | use Faulancer\Http\Request; |
| 15 | 14 | use Faulancer\Http\Response; |
| 16 | -use Faulancer\Helper\DirectoryIterator; |
|
| 17 | 15 | use Faulancer\Exception\MethodNotFoundException; |
| 18 | 16 | use Faulancer\Service\Config; |
| 19 | 17 | use Faulancer\Session\SessionManager; |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Faulancer\Exception\DispatchFailureException; |
| 13 | 13 | use Faulancer\Http\Request; |
| 14 | 14 | use Faulancer\Service\Config; |
| 15 | -use Faulancer\ServiceLocator\ServiceLocator; |
|
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * Class Kernel |
@@ -50,11 +50,11 @@ |
||
| 50 | 50 | |
| 51 | 51 | if (strpos($args[$i], '-') === false) { |
| 52 | 52 | continue; |
| 53 | - } else if (empty($args[$i+1])) { |
|
| 53 | + } else if (empty($args[$i + 1])) { |
|
| 54 | 54 | break; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $this->set(str_replace('-', '', $args[$i]), $args[$i+1]); |
|
| 57 | + $this->set(str_replace('-', '', $args[$i]), $args[$i + 1]); |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |