@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // iterate through all the entries |
173 | 173 | foreach ($this->flashdata as $variable => $data) { |
174 | 174 | // increment counter representing server requests |
175 | - $this->flashdata[$variable]['inc'] ++; |
|
175 | + $this->flashdata[$variable]['inc']++; |
|
176 | 176 | |
177 | 177 | // if we're past the first server request |
178 | 178 | if ($this->flashdata[$variable]['inc'] > 1) { |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | //@TODO this will not accept all float values, this validates /against/ syntax |
349 | 349 | |
350 | 350 | if (($int === (int)trim($data, '-')) && strlen((string)(int)$data) === strlen($data)) { |
351 | - $data = (int) $data; |
|
351 | + $data = (int)$data; |
|
352 | 352 | } elseif ($int !== $float && preg_match($re, $data) === 1) { |
353 | 353 | $data = floatval($data); |
354 | 354 | } |
@@ -368,12 +368,12 @@ discard block |
||
368 | 368 | $container = $name . 'Container'; |
369 | 369 | $container = $this->$container; |
370 | 370 | |
371 | - $argument = ! empty($arguments[0]) ? $arguments[0] : false; |
|
371 | + $argument = !empty($arguments[0]) ? $arguments[0] : false; |
|
372 | 372 | |
373 | 373 | if ($argument === false && !empty($container)) { |
374 | 374 | return $container; |
375 | 375 | } |
376 | - if (! empty($container[$argument])) { |
|
376 | + if (!empty($container[$argument])) { |
|
377 | 377 | if (!is_array($container[$argument]) |
378 | 378 | && !is_object($container[$argument]) |
379 | 379 | && strlen($container[$argument]) > 0 |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | - return ! empty($arguments[1]) ? $arguments[1] : false; |
|
387 | + return !empty($arguments[1]) ? $arguments[1] : false; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | throw new Exception\FunctionException('Method ' . $name . ' does not exist.'); |
@@ -200,6 +200,9 @@ discard block |
||
200 | 200 | return false; |
201 | 201 | } |
202 | 202 | |
203 | + /** |
|
204 | + * @param string|boolean $layout |
|
205 | + */ |
|
203 | 206 | public function setLayout($layout) |
204 | 207 | { |
205 | 208 | if ($layout === false) { |
@@ -241,6 +244,10 @@ discard block |
||
241 | 244 | * @return string processed content |
242 | 245 | */ |
243 | 246 | //@TODO: come back and clean up this and the way the view receives stuff |
247 | + |
|
248 | + /** |
|
249 | + * @param string|boolean $file |
|
250 | + */ |
|
244 | 251 | private function process($file) |
245 | 252 | { |
246 | 253 | ob_start(); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $this->view = $return = $this->process($view); |
134 | 134 | |
135 | - if (! is_null($this->layout)) { |
|
135 | + if (!is_null($this->layout)) { |
|
136 | 136 | $return = $this->process($this->layout); |
137 | 137 | } |
138 | 138 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->view = $this->process($this->view); |
143 | 143 | } |
144 | 144 | |
145 | - if (! is_null($this->layout)) { |
|
145 | + if (!is_null($this->layout)) { |
|
146 | 146 | return $this->process($this->layout); |
147 | 147 | } else { |
148 | 148 | return $this->view; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | foreach ($this->queuedCSS as $sheet) { |
275 | - $string .= '<link rel="stylesheet" href="' . $sheet .'">' . "\r\n"; |
|
275 | + $string .= '<link rel="stylesheet" href="' . $sheet . '">' . "\r\n"; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return $string; |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | // If there is no constructor, there is no |
63 | 63 | // dependencies, which means that our job is done. |
64 | - if (! $constructor) { |
|
64 | + if (!$constructor) { |
|
65 | 65 | $dependency = new $class; |
66 | 66 | if ($share === true) { |
67 | 67 | $this->dependencies[$class] = $dependency; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Zewa; |
5 | 5 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $result = []; |
134 | 134 | |
135 | 135 | foreach ($this->collection as $key => $item) { |
136 | - if (! $func($key, $item)) { |
|
136 | + if (!$func($key, $item)) { |
|
137 | 137 | $result[$key] = $item; |
138 | 138 | } |
139 | 139 | } |
@@ -195,7 +195,7 @@ |
||
195 | 195 | * Set optional status header, and redirect to provided URL |
196 | 196 | * |
197 | 197 | * @access public |
198 | - * @return bool |
|
198 | + * @return false|null |
|
199 | 199 | */ |
200 | 200 | public function redirect($url = '/', $status = null) |
201 | 201 | { |
@@ -168,7 +168,7 @@ |
||
168 | 168 | if (is_null($this->baseURL)) { |
169 | 169 | $self = $_SERVER['PHP_SELF']; |
170 | 170 | $server = $_SERVER['HTTP_HOST'] |
171 | - . rtrim(str_replace(strstr($self, 'index.php'), '', $self), '/'); |
|
171 | + . rtrim(str_replace(strstr($self, 'index.php'), '', $self), '/'); |
|
172 | 172 | |
173 | 173 | if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') |
174 | 174 | || !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Zewa; |
4 | 4 | |
5 | 5 | use Zewa\Exception\RouteException; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function currentURL($params = false) |
156 | 156 | { |
157 | - return $this->currentURL . (empty($_SERVER['QUERY_STRING'])?:'?' . $_SERVER['QUERY_STRING']); |
|
157 | + return $this->currentURL . (empty($_SERVER['QUERY_STRING']) ?: '?' . $_SERVER['QUERY_STRING']); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $dependencies = $this->dependencies->get('__dependencies'); |
27 | 27 | |
28 | - if(isset($dependencies[$class]) === false) { |
|
28 | + if (isset($dependencies[$class]) === false) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $reflectionClass = new \ReflectionClass($class); |
60 | 60 | $constructor = $reflectionClass->getConstructor(); |
61 | 61 | |
62 | - if (! $constructor || $constructor->getParameters() === 0) { |
|
62 | + if (!$constructor || $constructor->getParameters() === 0) { |
|
63 | 63 | $dependency = new $class; |
64 | 64 | return $this->load($class, $dependency, $persist); |
65 | 65 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | private function injectAppInstance($dependency) |
99 | 99 | { |
100 | - if($dependency instanceof Controller) { |
|
100 | + if ($dependency instanceof Controller) { |
|
101 | 101 | $dependency->setEvent($this->resolve('\Sabre\Event\Emitter')); |
102 | 102 | $dependency->setRequest($this->resolve('\Zewa\HTTP\Request')); |
103 | 103 | $dependency->setRouter($this->resolve('\Zewa\Router')); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Zewa; |
4 | 4 | |
5 | 5 | use Sabre\Event\Emitter; |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | { |
91 | 91 | $params = $this->router->getParameters(); |
92 | 92 | |
93 | - if($request !== null) { |
|
94 | - if(is_array($request)) { |
|
93 | + if ($request !== null) { |
|
94 | + if (is_array($request)) { |
|
95 | 95 | $callback = false; |
96 | 96 | $this->request->setRequest($this->dependency->resolve($request[0])); |
97 | 97 | $this->request->setMethod(($request[1]??[])); |
98 | - } else { |
|
98 | + } else { |
|
99 | 99 | $callback = true; |
100 | 100 | $this->request->setRequest($request); |
101 | 101 | array_unshift($params, $this->dependency); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $method = $this->request->getMethod(); |
117 | 117 | $params = $this->request->getParams(); |
118 | 118 | |
119 | - if($isRouteCallback === false) { // Routed Callback |
|
119 | + if ($isRouteCallback === false) { // Routed Callback |
|
120 | 120 | $this->output = call_user_func_array( |
121 | 121 | [&$request, $method], |
122 | 122 | $params |
@@ -95,7 +95,7 @@ |
||
95 | 95 | $callback = false; |
96 | 96 | $this->request->setRequest($this->dependency->resolve($request[0])); |
97 | 97 | $this->request->setMethod(($request[1]??[])); |
98 | - } else { |
|
98 | + } else { |
|
99 | 99 | $callback = true; |
100 | 100 | $this->request->setRequest($request); |
101 | 101 | array_unshift($params, $this->dependency); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public function normalize($data) |
16 | 16 | { |
17 | - if(!isset($data)) { |
|
17 | + if (!isset($data)) { |
|
18 | 18 | return null; |
19 | 19 | } |
20 | 20 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | //@TODO this will not accept all float values, this validates /against/ syntax |
49 | 49 | |
50 | 50 | if (($int === (int)trim($data, '-')) && strlen((string)(int)$data) === strlen($data)) { |
51 | - $data = (int) $data; |
|
51 | + $data = (int)$data; |
|
52 | 52 | } elseif ($int !== $float && preg_match($re, $data) === 1 && strlen($data) === strlen($float)) { |
53 | 53 | $data = $float; |
54 | 54 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Zewa; |
4 | 4 | |
5 | 5 | use Sabre\Event\Emitter; |