@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | protected function _validate() |
| 34 | 34 | { |
| 35 | - if(in_array($this->value, $this->getArrayOption('values'), true)) { |
|
| 35 | + if (in_array($this->value, $this->getArrayOption('values'), true)) { |
|
| 36 | 36 | return $this->value; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | protected function _validate() : ?int |
| 32 | 32 | { |
| 33 | - if(ConvertHelper::isInteger($this->value)) { |
|
| 33 | + if (ConvertHelper::isInteger($this->value)) { |
|
| 34 | 34 | return (int)$this->value; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -27,13 +27,13 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() : ?string |
| 29 | 29 | { |
| 30 | - if(!is_scalar($this->value)) { |
|
| 30 | + if (!is_scalar($this->value)) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $value = (string)$this->value; |
| 35 | 35 | |
| 36 | - if(preg_match('/\A[a-zA-Z]+\z/', $value)) { |
|
| 36 | + if (preg_match('/\A[a-zA-Z]+\z/', $value)) { |
|
| 37 | 37 | return $value; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -36,22 +36,22 @@ |
||
| 36 | 36 | |
| 37 | 37 | // if we are validating a subvalue, it means we are |
| 38 | 38 | // validating a single value in the existing list. |
| 39 | - if($this->isSubvalue) |
|
| 39 | + if ($this->isSubvalue) |
|
| 40 | 40 | { |
| 41 | - if(in_array($this->value, $allowed, true)) { |
|
| 41 | + if (in_array($this->value, $allowed, true)) { |
|
| 42 | 42 | return $this->value; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | return null; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if(!is_array($this->value)) { |
|
| 48 | + if (!is_array($this->value)) { |
|
| 49 | 49 | return array(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $keep = array(); |
| 53 | - foreach($this->value as $item) { |
|
| 54 | - if(in_array($item, $allowed, true)) { |
|
| 53 | + foreach ($this->value as $item) { |
|
| 54 | + if (in_array($item, $allowed, true)) { |
|
| 55 | 55 | $keep[] = $item; |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() : ?string |
| 29 | 29 | { |
| 30 | - if(!is_scalar($this->value)) { |
|
| 30 | + if (!is_scalar($this->value)) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | // is a boolean, which is converted to an integer when |
| 36 | 36 | // converted to string, which in turn can be validated |
| 37 | 37 | // with a regex. |
| 38 | - if(is_bool($this->value)) { |
|
| 38 | + if (is_bool($this->value)) { |
|
| 39 | 39 | return null; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $value = (string)$this->value; |
| 43 | 43 | |
| 44 | - if(preg_match($this->getStringOption('regex'), $value)) { |
|
| 44 | + if (preg_match($this->getStringOption('regex'), $value)) { |
|
| 45 | 45 | return $value; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() : string |
| 29 | 29 | { |
| 30 | - if(!is_string($this->value)) { |
|
| 30 | + if (!is_string($this->value)) { |
|
| 31 | 31 | return ''; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $info = parseURL($this->value); |
| 35 | - if($info->isValid()) { |
|
| 35 | + if ($info->isValid()) { |
|
| 36 | 36 | return $this->value; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -31,13 +31,13 @@ |
||
| 31 | 31 | |
| 32 | 32 | protected function _validate() : string |
| 33 | 33 | { |
| 34 | - if(!is_string($this->value)) { |
|
| 34 | + if (!is_string($this->value)) { |
|
| 35 | 35 | return ''; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $value = trim($this->value); |
| 39 | 39 | |
| 40 | - if(empty($value)) { |
|
| 40 | + if (empty($value)) { |
|
| 41 | 41 | return ''; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -50,13 +50,11 @@ |
||
| 50 | 50 | { |
| 51 | 51 | return $value; |
| 52 | 52 | } |
| 53 | - } |
|
| 54 | - else if (is_array(json_decode($value, true, 512, JSON_THROW_ON_ERROR))) |
|
| 53 | + } else if (is_array(json_decode($value, true, 512, JSON_THROW_ON_ERROR))) |
|
| 55 | 54 | { |
| 56 | 55 | return $value; |
| 57 | 56 | } |
| 58 | - } |
|
| 59 | - catch (Throwable $e) |
|
| 57 | + } catch (Throwable $e) |
|
| 60 | 58 | { |
| 61 | 59 | // Invalid JSON must return an empty string. |
| 62 | 60 | // The application is responsible for asserting |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | protected function _validate() |
| 32 | 32 | { |
| 33 | - if(is_numeric($this->value)) { |
|
| 33 | + if (is_numeric($this->value)) { |
|
| 34 | 34 | return $this->value * 1; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | private function filterScheme() : void |
| 40 | 40 | { |
| 41 | - if($this->hasScheme()) |
|
| 41 | + if ($this->hasScheme()) |
|
| 42 | 42 | { |
| 43 | 43 | $this->setScheme(strtolower($this->getScheme())); |
| 44 | 44 | } |
| 45 | 45 | else |
| 46 | 46 | { |
| 47 | 47 | $scheme = URISchemes::detectScheme($this->url); |
| 48 | - if(!empty($scheme)) { |
|
| 48 | + if (!empty($scheme)) { |
|
| 49 | 49 | $this->setScheme(URISchemes::resolveSchemeName($scheme)); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | private function filterAuth() : void |
| 55 | 55 | { |
| 56 | - if(!$this->hasAuth()) { |
|
| 56 | + if (!$this->hasAuth()) { |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | private function filterHost() : void |
| 67 | 67 | { |
| 68 | - if(!$this->hasHost()) |
|
| 68 | + if (!$this->hasHost()) |
|
| 69 | 69 | { |
| 70 | 70 | return; |
| 71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | private function filterPath() : void |
| 80 | 80 | { |
| 81 | - if($this->hasPath()) { |
|
| 81 | + if ($this->hasPath()) { |
|
| 82 | 82 | $this->setPath(str_replace(' ', '', $this->getPath())); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $host = $this->getPath(); |
| 89 | 89 | |
| 90 | - if(empty($host) || !URLHosts::isHostKnown($host)) |
|
| 90 | + if (empty($host) || !URLHosts::isHostKnown($host)) |
|
| 91 | 91 | { |
| 92 | 92 | return; |
| 93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $this->setHost($host); |
| 96 | 96 | $this->removePath(); |
| 97 | 97 | |
| 98 | - if(!$this->hasScheme()) { |
|
| 98 | + if (!$this->hasScheme()) { |
|
| 99 | 99 | $this->setSchemeHTTPS(); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $this->info['params'] = array(); |
| 106 | 106 | |
| 107 | 107 | $query = $this->getQuery(); |
| 108 | - if(empty($query)) { |
|
| 108 | + if (empty($query)) { |
|
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | if($this->hasScheme()) |
| 42 | 42 | { |
| 43 | 43 | $this->setScheme(strtolower($this->getScheme())); |
| 44 | - } |
|
| 45 | - else |
|
| 44 | + } else |
|
| 46 | 45 | { |
| 47 | 46 | $scheme = URISchemes::detectScheme($this->url); |
| 48 | 47 | if(!empty($scheme)) { |