@@ -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 | { |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | public function render(string $template = "", array $variables = []) |
| 54 | 54 | { |
| 55 | 55 | $view = new ViewController(); |
| 56 | - $view->setTemplate( $template ); |
|
| 57 | - $view->setVariables( $variables ); |
|
| 56 | + $view->setTemplate($template); |
|
| 57 | + $view->setVariables($variables); |
|
| 58 | 58 | return $view->render(); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function renderBlock(string $name, string $default = "") |
| 101 | 101 | { |
| 102 | - if($this->view->getVariable($name) == null) { |
|
| 102 | + if ($this->view->getVariable($name) == null) { |
|
| 103 | 103 | return $default; |
| 104 | 104 | } |
| 105 | - return trim($this->view->getVariable( $name )); |
|
| 105 | + return trim($this->view->getVariable($name)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function escape(string $string) |
| 114 | 114 | { |
| 115 | - return stripslashes( strip_tags( $string ) ); |
|
| 115 | + return stripslashes(strip_tags($string)); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $files = $this->view->getVariable('assets'.ucfirst($type)); |
|
| 140 | + $files = $this->view->getVariable('assets' . ucfirst($type)); |
|
| 141 | 141 | |
| 142 | 142 | foreach ($files AS $file) { |
| 143 | - $result .= sprintf($pattern, $file). "\n"; |
|
| 143 | + $result .= sprintf($pattern, $file) . "\n"; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $result; |
@@ -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 | } |