@@ -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 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | namespace Zewa\HTTP; |
| 4 | 4 | |
| 5 | 5 | use Zewa\Container; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | parent::__construct($container, $security); |
| 13 | 13 | |
| 14 | - if($_SERVER['REQUEST_METHOD'] === "PUT") { |
|
| 14 | + if ($_SERVER['REQUEST_METHOD'] === "PUT") { |
|
| 15 | 15 | parse_str(file_get_contents('php://input', "r"), $put); |
| 16 | 16 | $_POST = []; |
| 17 | 17 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | namespace Zewa\HTTP; |
| 4 | 4 | |
| 5 | 5 | use Zewa\Interfaces\HTTP\GlobalInterface; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function fetch(string $key = null, $default = null) |
| 36 | 36 | { |
| 37 | 37 | $global = $this->getGlobalName(); |
| 38 | - if($key === null) { |
|
| 38 | + if ($key === null) { |
|
| 39 | 39 | return $this->container->get($global); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function remove(string $key) |
| 46 | 46 | { |
| 47 | 47 | $global = $this->getGlobalName(); |
| 48 | - if($this->container->has($global)) { |
|
| 48 | + if ($this->container->has($global)) { |
|
| 49 | 49 | $this->processRemoval($key); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $global = $this->getGlobalName(); |
| 61 | 61 | $container = $this->container->get($global); |
| 62 | - if(isset($container[$key])) { |
|
| 62 | + if (isset($container[$key])) { |
|
| 63 | 63 | unset($container[$key]); |
| 64 | 64 | $this->container->set($global, $container); |
| 65 | 65 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | namespace Zewa\HTTP; |
| 4 | 4 | |
| 5 | 5 | use Zewa\Container; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | private function incrementFlashStorage(array $storage) |
| 51 | 51 | { |
| 52 | 52 | foreach ($storage as $variable => $data) { |
| 53 | - $storage[$variable]['increment'] ++; |
|
| 53 | + $storage[$variable]['increment']++; |
|
| 54 | 54 | if ($storage[$variable]['increment'] > 1) { |
| 55 | 55 | unset($_SESSION[$variable], $storage[$variable]); |
| 56 | 56 | } else { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | namespace Zewa\HTTP; |
| 4 | 4 | |
| 5 | 5 | use Zewa\Container; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | parent::__construct($container, $security); |
| 13 | 13 | |
| 14 | - if($_SERVER['REQUEST_METHOD'] === "DELETE") { |
|
| 14 | + if ($_SERVER['REQUEST_METHOD'] === "DELETE") { |
|
| 15 | 15 | parse_str(file_get_contents('php://input', "r"), $delete); |
| 16 | 16 | $_POST = []; |
| 17 | 17 | } |