@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function detect() : bool |
12 | 12 | { |
13 | - if($this->hasHost() || $this->hasQuery() || $this->hasScheme()) { |
|
13 | + if ($this->hasHost() || $this->hasQuery() || $this->hasScheme()) { |
|
14 | 14 | $this->setTypeURL(); |
15 | 15 | return true; |
16 | 16 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function detect() : bool |
13 | 13 | { |
14 | - if($this->hasFragment() && (!$this->hasScheme() && !$this->hasHost() && !$this->hasQuery() && !$this->hasPath())) { |
|
14 | + if ($this->hasFragment() && (!$this->hasScheme() && !$this->hasHost() && !$this->hasQuery() && !$this->hasPath())) { |
|
15 | 15 | $this->setTypeFragment(); |
16 | 16 | return true; |
17 | 17 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | public function detect() : bool |
13 | 13 | { |
14 | - if(!$this->hasHost() && $this->hasPath() && preg_match(RegexHelper::REGEX_IPV4, $this->getPath())) { |
|
14 | + if (!$this->hasHost() && $this->hasPath() && preg_match(RegexHelper::REGEX_IPV4, $this->getPath())) { |
|
15 | 15 | $this |
16 | 16 | ->setHost($this->getPath()) |
17 | 17 | ->setSchemeHTTPS() |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | return true; |
23 | 23 | } |
24 | 24 | |
25 | - if($this->hasHost() && preg_match(RegexHelper::REGEX_IPV4, $this->getHost())) { |
|
25 | + if ($this->hasHost() && preg_match(RegexHelper::REGEX_IPV4, $this->getHost())) { |
|
26 | 26 | $this->setIP($this->getHost()); |
27 | 27 | $this->setTypeURL(); |
28 | 28 | return true; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function detect() : bool |
13 | 13 | { |
14 | - if($this->getScheme() === 'tel') { |
|
14 | + if ($this->getScheme() === 'tel') { |
|
15 | 15 | $this->setTypePhone(); |
16 | 16 | return true; |
17 | 17 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | // every link needs a host. This case can happen for ex, if |
16 | 16 | // the link starts with a typo with only one slash, like: |
17 | 17 | // "http:/hostname" |
18 | - if($this->hasHost() || $this->isSchemeLess()) { |
|
18 | + if ($this->hasHost() || $this->isSchemeLess()) { |
|
19 | 19 | return true; |
20 | 20 | } |
21 | 21 | |
22 | 22 | $this->parser->setError( |
23 | 23 | URLInfo::ERROR_MISSING_HOST, |
24 | - t('Cannot determine the link\'s host name.') . ' ' . |
|
24 | + t('Cannot determine the link\'s host name.').' '. |
|
25 | 25 | t('This usually happens when there\'s a typo somewhere.') |
26 | 26 | ); |
27 | 27 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | public function validate() : bool |
14 | 14 | { |
15 | - if($this->getType() !== URLInfo::TYPE_NONE) |
|
15 | + if ($this->getType() !== URLInfo::TYPE_NONE) |
|
16 | 16 | { |
17 | 17 | return true; |
18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | public function validate() : bool |
14 | 14 | { |
15 | - if($this->hasScheme() || $this->isFragmentOnly()) { |
|
15 | + if ($this->hasScheme() || $this->isFragmentOnly()) { |
|
16 | 16 | return true; |
17 | 17 | } |
18 | 18 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function validate() : bool |
15 | 15 | { |
16 | - if(!$this->hasScheme() || URISchemes::isValidSchemeName((string)$this->getScheme())) { |
|
16 | + if (!$this->hasScheme() || URISchemes::isValidSchemeName((string)$this->getScheme())) { |
|
17 | 17 | return true; |
18 | 18 | } |
19 | 19 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $this->parser->setError( |
23 | 23 | URLInfo::ERROR_INVALID_SCHEME, |
24 | - t('The scheme %1$s is not supported for links.', $this->getScheme()) . ' ' . |
|
24 | + t('The scheme %1$s is not supported for links.', $this->getScheme()).' '. |
|
25 | 25 | t('Valid schemes are: %1$s.', implode(', ', URISchemes::getSchemeNames())) |
26 | 26 | ); |
27 | 27 |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function detectScheme(string $url) : ?string |
75 | 75 | { |
76 | - foreach(self::$schemes as $scheme) { |
|
77 | - if(stripos($url, $scheme) === 0) { |
|
76 | + foreach (self::$schemes as $scheme) { |
|
77 | + if (stripos($url, $scheme) === 0) { |
|
78 | 78 | return $scheme; |
79 | 79 | } |
80 | 80 | } |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @var string[]|null |
87 | 87 | */ |
88 | - private static ?array $schemeNames = null; |
|
88 | + private static ? array $schemeNames = null; |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @return string[] |
92 | 92 | */ |
93 | 93 | public static function getSchemeNames() : array |
94 | 94 | { |
95 | - if(isset(self::$schemeNames)) { |
|
95 | + if (isset(self::$schemeNames)) { |
|
96 | 96 | return self::$schemeNames; |
97 | 97 | } |
98 | 98 | |
99 | 99 | self::$schemeNames = array(); |
100 | 100 | |
101 | - foreach(self::$schemes as $scheme) { |
|
101 | + foreach (self::$schemes as $scheme) { |
|
102 | 102 | self::$schemeNames[] = self::resolveSchemeName($scheme); |
103 | 103 | } |
104 | 104 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | self::requireValidScheme($scheme); |
133 | 133 | |
134 | - if(!in_array($scheme, self::$schemes, true)) |
|
134 | + if (!in_array($scheme, self::$schemes, true)) |
|
135 | 135 | { |
136 | 136 | self::$schemes[] = $scheme; |
137 | 137 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | public static function requireValidScheme(string $scheme) : void |
143 | 143 | { |
144 | - if(strpos($scheme, ':')) |
|
144 | + if (strpos($scheme, ':')) |
|
145 | 145 | { |
146 | 146 | return; |
147 | 147 | } |