@@ -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 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param bool $verifySSL |
49 | 49 | * @return URIConnectionTester |
50 | 50 | */ |
51 | - public function setVerifySSL(bool $verifySSL=true) : URIConnectionTester |
|
51 | + public function setVerifySSL(bool $verifySSL = true) : URIConnectionTester |
|
52 | 52 | { |
53 | 53 | $this->setOption('verify-ssl', $verifySSL); |
54 | 54 | return $this; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | return $this->getBoolOption('verify-ssl'); |
60 | 60 | } |
61 | 61 | |
62 | - public function setVerboseMode(bool $enabled=true) : URIConnectionTester |
|
62 | + public function setVerboseMode(bool $enabled = true) : URIConnectionTester |
|
63 | 63 | { |
64 | 64 | $this->setOption('curl-verbose', $enabled); |
65 | 65 | return $this; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $ch = curl_init(); |
93 | 93 | |
94 | - if(!is_resource($ch)) |
|
94 | + if (!is_resource($ch)) |
|
95 | 95 | { |
96 | 96 | throw new URLException( |
97 | 97 | 'Could not initialize a new cURL instance.', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function configureOptions($ch) : void |
110 | 110 | { |
111 | - if($this->isVerboseModeEnabled()) |
|
111 | + if ($this->isVerboseModeEnabled()) |
|
112 | 112 | { |
113 | 113 | curl_setopt($ch, CURLOPT_VERBOSE, true); |
114 | 114 | } |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | curl_setopt($ch, CURLOPT_TIMEOUT, $this->getTimeout()); |
119 | 119 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
120 | 120 | |
121 | - if(!$this->isVerifySSLEnabled()) |
|
121 | + if (!$this->isVerifySSLEnabled()) |
|
122 | 122 | { |
123 | 123 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
124 | 124 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
125 | 125 | } |
126 | 126 | |
127 | - if($this->url->hasUsername()) |
|
127 | + if ($this->url->hasUsername()) |
|
128 | 128 | { |
129 | 129 | curl_setopt($ch, CURLOPT_USERNAME, $this->url->getUsername()); |
130 | 130 | curl_setopt($ch, CURLOPT_PASSWORD, $this->url->getPassword()); |