Passed
Push — master ( b083ab...a3db06 )
by Sebastian
03:30
created
src/BaseException.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 {
26 26
     protected ?string $details = null;
27 27
     
28
-   /**
29
-    * @param string $message
30
-    * @param string|NULL $details
31
-    * @param int|NULL $code
32
-    * @param Throwable|NULL $previous
33
-    */
28
+    /**
29
+     * @param string $message
30
+     * @param string|NULL $details
31
+     * @param int|NULL $code
32
+     * @param Throwable|NULL $previous
33
+     */
34 34
     public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null)
35 35
     {
36 36
         if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true')
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         if($code === null)
42 42
         {
43
-             $code = 0;
43
+                $code = 0;
44 44
         }
45 45
 
46 46
         parent::__construct($message, (int)$code, $previous);
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
         $this->details = $details;
49 49
     }
50 50
     
51
-   /**
52
-    * Retrieves the detailed error description, if any.
53
-    * @return string
54
-    */
51
+    /**
52
+     * Retrieves the detailed error description, if any.
53
+     * @return string
54
+     */
55 55
     public function getDetails() : string
56 56
     {
57 57
         return $this->details ?? '';
58 58
     }
59 59
     
60
-   /**
61
-    * Displays pertinent information on the exception.
62
-    */
60
+    /**
61
+     * Displays pertinent information on the exception.
62
+     */
63 63
     public function display() : void
64 64
     {
65 65
         if(!headers_sent()) {
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
         echo $this->getInfo();
70 70
     }
71 71
     
72
-   /**
73
-    * Retrieves information on the exception that can be
74
-    * easily accessed.
75
-    * 
76
-    * @return ConvertHelper_ThrowableInfo
77
-    */
72
+    /**
73
+     * Retrieves information on the exception that can be
74
+     * easily accessed.
75
+     * 
76
+     * @return ConvertHelper_ThrowableInfo
77
+     */
78 78
     public function getInfo() : ConvertHelper_ThrowableInfo
79 79
     {
80 80
         return ConvertHelper::throwable2info($this);
81 81
     }
82 82
     
83
-   /**
84
-    * Dumps a current PHP function trace, as a text only string.
85
-    */
83
+    /**
84
+     * Dumps a current PHP function trace, as a text only string.
85
+     */
86 86
     public static function dumpTraceAsString() : void
87 87
     {
88 88
         try
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
         }
96 96
     }
97 97
 
98
-   /**
99
-    * Dumps a current PHP function trace, with HTML styling.
100
-    */
98
+    /**
99
+     * Dumps a current PHP function trace, with HTML styling.
100
+     */
101 101
     public static function dumpTraceAsHTML() : void
102 102
     {
103 103
         try
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
         }
113 113
     }
114 114
     
115
-   /**
116
-    * Creates an exception info instance from a throwable instance.
117
-    * 
118
-    * @param Throwable $e
119
-    * @return ConvertHelper_ThrowableInfo
120
-    * @see ConvertHelper::throwable2info()
121
-    */
115
+    /**
116
+     * Creates an exception info instance from a throwable instance.
117
+     * 
118
+     * @param Throwable $e
119
+     * @return ConvertHelper_ThrowableInfo
120
+     * @see ConvertHelper::throwable2info()
121
+     */
122 122
     public static function createInfo(Throwable $e) : ConvertHelper_ThrowableInfo
123 123
     {
124 124
         return ConvertHelper::throwable2info($e);
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         self::TYPE_TRAIT
49 49
     );
50 50
 
51
-   /**
52
-    * @param PHPFile $path The path to the PHP file to parse.
53
-    * @throws FileHelper_Exception
54
-    * @see FileHelper::findPHPClasses()
55
-    */
51
+    /**
52
+     * @param PHPFile $path The path to the PHP file to parse.
53
+     * @throws FileHelper_Exception
54
+     * @see FileHelper::findPHPClasses()
55
+     */
56 56
     public function __construct(PHPFile $path)
57 57
     {
58 58
         $this->file = $path
@@ -62,58 +62,58 @@  discard block
 block discarded – undo
62 62
         $this->parseFile();
63 63
     }
64 64
     
65
-   /**
66
-    * The name of the namespace of the classes in the file, if any.
67
-    * @return string
68
-    */
65
+    /**
66
+     * The name of the namespace of the classes in the file, if any.
67
+     * @return string
68
+     */
69 69
     public function getNamespace() : string
70 70
     {
71 71
         return $this->namespace;
72 72
     }
73 73
     
74
-   /**
75
-    * Whether the file contains a namespace.
76
-    * @return bool
77
-    */
74
+    /**
75
+     * Whether the file contains a namespace.
76
+     * @return bool
77
+     */
78 78
     public function hasNamespace() : bool
79 79
     {
80 80
         return !empty($this->namespace);
81 81
     }
82 82
     
83
-   /**
84
-    * The absolute path to the file.
85
-    * @return string
86
-    */
83
+    /**
84
+     * The absolute path to the file.
85
+     * @return string
86
+     */
87 87
     public function getPath() : string
88 88
     {
89 89
         return $this->file->getPath();
90 90
     }
91 91
    
92
-   /**
93
-    * Whether any classes were found in the file.
94
-    * @return bool
95
-    */
92
+    /**
93
+     * Whether any classes were found in the file.
94
+     * @return bool
95
+     */
96 96
     public function hasClasses() : bool
97 97
     {
98 98
         return !empty($this->classes);
99 99
     }
100 100
     
101
-   /**
102
-    * The names of the classes that were found in the file (with namespace if any).
103
-    * @return string[]
104
-    */
101
+    /**
102
+     * The names of the classes that were found in the file (with namespace if any).
103
+     * @return string[]
104
+     */
105 105
     public function getClassNames() : array
106 106
     {
107 107
         return array_keys($this->classes);
108 108
     }
109 109
     
110
-   /**
111
-    * Retrieves all classes that were detected in the file,
112
-    * which can be used to retrieve more information about
113
-    * them.
114
-    * 
115
-    * @return FileHelper_PHPClassInfo_Class[]
116
-    */
110
+    /**
111
+     * Retrieves all classes that were detected in the file,
112
+     * which can be used to retrieve more information about
113
+     * them.
114
+     * 
115
+     * @return FileHelper_PHPClassInfo_Class[]
116
+     */
117 117
     public function getClasses() : array
118 118
     {
119 119
         return array_values($this->classes);
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
         $this->classes[$class->getNameNS()] = $class;
186 186
     }
187 187
 
188
-   /**
189
-    * Strips all whitespace from the string, replacing it with 
190
-    * regular spaces (newlines, tabs, etc.).
191
-    * 
192
-    * @param string $string
193
-    * @return string
194
-    */
188
+    /**
189
+     * Strips all whitespace from the string, replacing it with 
190
+     * regular spaces (newlines, tabs, etc.).
191
+     * 
192
+     * @param string $string
193
+     * @return string
194
+     */
195 195
     protected function stripWhitespace(string $string) : string 
196 196
     {
197 197
         return preg_replace('/\s/', ' ', $string);
Please login to merge, or discard this patch.
src/Request/AcceptHeaders.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -33,22 +33,22 @@  discard block
 block discarded – undo
33 33
         $this->parse();
34 34
     }
35 35
     
36
-   /**
37
-    * Retrieves an indexed array with accept mime types
38
-    * that the client sent, in the order of preference
39
-    * the client specified.
40
-    *
41
-    * Example:
42
-    *
43
-    * array(
44
-    *     'text/html',
45
-    *     'application/xhtml+xml',
46
-    *     'image/webp'
47
-    *     ...
48
-    * )
49
-    *
50
-    * @return string[]
51
-    */
36
+    /**
37
+     * Retrieves an indexed array with accept mime types
38
+     * that the client sent, in the order of preference
39
+     * the client specified.
40
+     *
41
+     * Example:
42
+     *
43
+     * array(
44
+     *     'text/html',
45
+     *     'application/xhtml+xml',
46
+     *     'image/webp'
47
+     *     ...
48
+     * )
49
+     *
50
+     * @return string[]
51
+     */
52 52
     public function getMimeStrings() : array
53 53
     {
54 54
         $result = array();
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
         return $result;
62 62
     }
63 63
     
64
-   /**
65
-    * Checks that an "Accept" header string exists, and tries to parse it.
66
-    */
64
+    /**
65
+     * Checks that an "Accept" header string exists, and tries to parse it.
66
+     */
67 67
     protected function parse() : void
68 68
     {
69 69
         // we may be in a CLI environment where the headers
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
         $this->headers = $this->parseHeader($_SERVER['HTTP_ACCEPT']);
76 76
     }
77 77
     
78
-   /**
79
-    * Splits the "Accept" header string and parses the mime types.
80
-    *  
81
-    * @param string $acceptHeader
82
-    * @return AcceptHeader[]
83
-    */
78
+    /**
79
+     * Splits the "Accept" header string and parses the mime types.
80
+     *  
81
+     * @param string $acceptHeader
82
+     * @return AcceptHeader[]
83
+     */
84 84
     protected function parseHeader(string $acceptHeader) : array
85 85
     {
86 86
         $tokens = preg_split('/\s*,\s*/', $acceptHeader);
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
         return $accept;
98 98
     }
99 99
     
100
-   /**
101
-    * Parses a single mime type entry.
102
-    * 
103
-    * @param int $i The position in the "Accept" string
104
-    * @param string $mime The mime type
105
-    * @return AcceptHeader
106
-    */
100
+    /**
101
+     * Parses a single mime type entry.
102
+     * 
103
+     * @param int $i The position in the "Accept" string
104
+     * @param string $mime The mime type
105
+     * @return AcceptHeader
106
+     */
107 107
     protected function parseEntry(int $i, string $mime) : AcceptHeader
108 108
     {
109 109
         $quality = 0;
Please login to merge, or discard this patch.
src/URLInfo/URIParser.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
     protected bool $isValid = false;
43 43
     protected bool $encodeUTF = false;
44 44
 
45
-   /**
46
-    * @var array{code:int,message:string}|NULL
47
-    */
45
+    /**
46
+     * @var array{code:int,message:string}|NULL
47
+     */
48 48
     protected ?array $error = null;
49 49
     
50
-   /**
51
-    * Stores a list of all unicode characters in the URL
52
-    * that have been filtered out before parsing it with
53
-    * parse_url.
54
-    * 
55
-    * @var array<string,string>
56
-    */
50
+    /**
51
+     * Stores a list of all unicode characters in the URL
52
+     * that have been filtered out before parsing it with
53
+     * parse_url.
54
+     * 
55
+     * @var array<string,string>
56
+     */
57 57
     protected array $unicodeChars = array();
58 58
 
59 59
     /**
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
     );
79 79
 
80 80
     /**
81
-    * 
82
-    * @param string $url The target URL.
83
-    * @param bool $encodeUTF Whether to URL encode any plain text unicode characters.
84
-    */
81
+     * 
82
+     * @param string $url The target URL.
83
+     * @param bool $encodeUTF Whether to URL encode any plain text unicode characters.
84
+     */
85 85
     public function __construct(string $url, bool $encodeUTF)
86 86
     {
87 87
         $this->url = $url;
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
         $this->validate();
93 93
     }
94 94
 
95
-   /**
96
-    * Retrieves the array as parsed by PHP's parse_url,
97
-    * filtered and adjusted as necessary.
98
-    * 
99
-    * @return array
100
-    */
95
+    /**
96
+     * Retrieves the array as parsed by PHP's parse_url,
97
+     * filtered and adjusted as necessary.
98
+     * 
99
+     * @return array
100
+     */
101 101
     public function getInfo() : array
102 102
     {
103 103
         return $this->info;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
         }
120 120
     }
121 121
 
122
-   /**
123
-    * Finds any non-url encoded unicode characters in 
124
-    * the URL, and encodes them before the URL is 
125
-    * passed to parse_url.
126
-    */
122
+    /**
123
+     * Finds any non-url encoded unicode characters in 
124
+     * the URL, and encodes them before the URL is 
125
+     * passed to parse_url.
126
+     */
127 127
     protected function filterUnicodeChars() : void
128 128
     {
129 129
         $chars = ConvertHelper::string2array($this->url);
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
         $this->isValid = true;
195 195
     }
196 196
 
197
-   /**
198
-    * Goes through all information in the parse_url result
199
-    * array, and attempts to fix any user errors in formatting
200
-    * that can be recovered from, mostly regarding stray spaces.
201
-    */
197
+    /**
198
+     * Goes through all information in the parse_url result
199
+     * array, and attempts to fix any user errors in formatting
200
+     * that can be recovered from, mostly regarding stray spaces.
201
+     */
202 202
     protected function filterParsed() : void
203 203
     {
204 204
         $this->info['params'] = array();
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
         }
253 253
     }
254 254
     
255
-   /**
256
-    * Recursively goes through the array, and converts all previously
257
-    * URL encoded characters with their unicode character counterparts.
258
-    * 
259
-    * @param array $subject
260
-    * @return array
261
-    */
255
+    /**
256
+     * Recursively goes through the array, and converts all previously
257
+     * URL encoded characters with their unicode character counterparts.
258
+     * 
259
+     * @param array $subject
260
+     * @return array
261
+     */
262 262
     protected function restoreUnicodeChars(array $subject) : array
263 263
     {
264 264
         $result = array();
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
         return $result;
283 283
     }
284 284
     
285
-   /**
286
-    * Replaces all URL encoded unicode characters
287
-    * in the string with the unicode character.
288
-    * 
289
-    * @param string $string
290
-    * @return string
291
-    */
285
+    /**
286
+     * Replaces all URL encoded unicode characters
287
+     * in the string with the unicode character.
288
+     * 
289
+     * @param string $string
290
+     * @return string
291
+     */
292 292
     protected function restoreUnicodeChar(string $string) : string
293 293
     {
294 294
         if(strpos($string, '%') !== false)
@@ -309,32 +309,32 @@  discard block
 block discarded – undo
309 309
         );
310 310
     }
311 311
    
312
-   /**
313
-    * Checks whether the URL that was parsed is valid.
314
-    * @return bool
315
-    */
312
+    /**
313
+     * Checks whether the URL that was parsed is valid.
314
+     * @return bool
315
+     */
316 316
     public function isValid() : bool
317 317
     {
318 318
         return $this->isValid;
319 319
     }
320 320
 
321
-   /**
322
-    * If the validation failed, retrieves the validation
323
-    * error message.
324
-    * 
325
-    * @return string
326
-    */
321
+    /**
322
+     * If the validation failed, retrieves the validation
323
+     * error message.
324
+     * 
325
+     * @return string
326
+     */
327 327
     public function getErrorMessage() : string
328 328
     {
329 329
         return $this->error['message'] ?? '';
330 330
     }
331 331
     
332
-   /**
333
-    * If the validation failed, retrieves the validation
334
-    * error code.
335
-    * 
336
-    * @return int
337
-    */
332
+    /**
333
+     * If the validation failed, retrieves the validation
334
+     * error code.
335
+     * 
336
+     * @return int
337
+     */
338 338
     public function getErrorCode() : int
339 339
     {
340 340
         return $this->error['code'] ?? -1;
Please login to merge, or discard this patch.
src/URLInfo/URIConnectionTester.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
         );
42 42
     }
43 43
     
44
-   /**
45
-    * Whether to verify the host's SSL certificate, in
46
-    * case of a https connection.
47
-    * 
48
-    * @param bool $verifySSL
49
-    * @return URIConnectionTester
50
-    */
44
+    /**
45
+     * Whether to verify the host's SSL certificate, in
46
+     * case of a https connection.
47
+     * 
48
+     * @param bool $verifySSL
49
+     * @return URIConnectionTester
50
+     */
51 51
     public function setVerifySSL(bool $verifySSL=true) : URIConnectionTester
52 52
     {
53 53
         $this->setOption('verify-ssl', $verifySSL);
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
         return $this->getIntOption('timeout');
82 82
     }
83 83
     
84
-   /**
85
-    * Initializes the CURL instance.
86
-    * 
87
-    * @throws BaseException
88
-    * @return resource
89
-    */
84
+    /**
85
+     * Initializes the CURL instance.
86
+     * 
87
+     * @throws BaseException
88
+     * @return resource
89
+     */
90 90
     private function initCURL()
91 91
     {
92 92
         $ch = curl_init();
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
         return $ch;
104 104
     }
105 105
     
106
-   /**
107
-    * @param resource $ch
108
-    */
106
+    /**
107
+     * @param resource $ch
108
+     */
109 109
     private function configureOptions($ch) : void
110 110
     {
111 111
         if($this->isVerboseModeEnabled())
Please login to merge, or discard this patch.
src/URLInfo/URINormalizer.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@
 block discarded – undo
28 28
         $this->info = $info;
29 29
     }
30 30
     
31
-   /**
32
-    * Enables the authentication information in the URL,
33
-    * if a username and password are present.
34
-    * 
35
-    * @param bool $enable Whether to turn it on or off.
36
-    * @return URINormalizer
37
-    */
31
+    /**
32
+     * Enables the authentication information in the URL,
33
+     * if a username and password are present.
34
+     * 
35
+     * @param bool $enable Whether to turn it on or off.
36
+     * @return URINormalizer
37
+     */
38 38
     public function enableAuth(bool $enable=true) : URINormalizer
39 39
     {
40 40
         $this->auth = $enable;
41 41
         return $this;
42 42
     }
43 43
     
44
-   /**
45
-    * Retrieves the normalized URL.
46
-    * @return string
47
-    */
44
+    /**
45
+     * Retrieves the normalized URL.
46
+     * @return string
47
+     */
48 48
     public function normalize() : string
49 49
     {
50 50
         $method = 'normalize_'.$this->info->getType();
Please login to merge, or discard this patch.
src/URLInfo/URIHighlighter.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -155,13 +155,13 @@
 block discarded – undo
155 155
         );
156 156
     }
157 157
     
158
-   /**
159
-    * Fetches all parameters in the URL, regardless of 
160
-    * whether parameter exclusion is enabled, so they
161
-    * can be highlighted is need be.
162
-    * 
163
-    * @return array<string,string>
164
-    */
158
+    /**
159
+     * Fetches all parameters in the URL, regardless of 
160
+     * whether parameter exclusion is enabled, so they
161
+     * can be highlighted is need be.
162
+     * 
163
+     * @return array<string,string>
164
+     */
165 165
     protected function resolveParams() : array
166 166
     {
167 167
         $previous = $this->info->isParamExclusionEnabled();
Please login to merge, or discard this patch.
src/URLInfo.php 1 patch
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -44,42 +44,42 @@  discard block
 block discarded – undo
44 44
     public const TYPE_URL = 'url';
45 45
     public const TYPE_NONE = 'none';
46 46
 
47
-   /**
48
-    * The original URL that was passed to the constructor.
49
-    * @var string
50
-    */
47
+    /**
48
+     * The original URL that was passed to the constructor.
49
+     * @var string
50
+     */
51 51
     protected string $rawURL;
52 52
 
53
-   /**
54
-    * @var array<string,mixed>
55
-    */
53
+    /**
54
+     * @var array<string,mixed>
55
+     */
56 56
     protected array $info;
57 57
     
58
-   /**
59
-    * @var string[]
60
-    */
58
+    /**
59
+     * @var string[]
60
+     */
61 61
     protected array $excludedParams = array();
62 62
     
63
-   /**
64
-    * @var bool
65
-    * @see URLInfo::setParamExclusion()
66
-    */
63
+    /**
64
+     * @var bool
65
+     * @see URLInfo::setParamExclusion()
66
+     */
67 67
     protected bool $paramExclusion = false;
68 68
     
69
-   /**
70
-    * @var array<string,string>|NULL
71
-    * @see URLInfo::getTypeLabel()
72
-    */
69
+    /**
70
+     * @var array<string,string>|NULL
71
+     * @see URLInfo::getTypeLabel()
72
+     */
73 73
     protected static ?array $typeLabels = null;
74 74
     
75
-   /**
76
-    * @var bool
77
-    */
75
+    /**
76
+     * @var bool
77
+     */
78 78
     protected bool $highlightExcluded = false;
79 79
     
80
-   /**
81
-    * @var string[]
82
-    */
80
+    /**
81
+     * @var string[]
82
+     */
83 83
     protected array $infoKeys = array(
84 84
         'scheme',
85 85
         'host',
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
         'fragment'
92 92
     );
93 93
     
94
-   /**
95
-    * @var string
96
-    */
94
+    /**
95
+     * @var string
96
+     */
97 97
     protected string $url;
98 98
     
99
-   /**
100
-    * @var URIParser
101
-    */
99
+    /**
100
+     * @var URIParser
101
+     */
102 102
     protected URIParser $parser;
103 103
     
104
-   /**
105
-    * @var URINormalizer|NULL
106
-    */
104
+    /**
105
+     * @var URINormalizer|NULL
106
+     */
107 107
     protected ?URINormalizer $normalizer = null;
108 108
     
109
-   /**
110
-    * @var bool
111
-    */
109
+    /**
110
+     * @var bool
111
+     */
112 112
     protected bool $encodeUTFChars = false;
113 113
     
114 114
     public function __construct(string $url)
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
         $this->info = $this->parser->getInfo();
126 126
     }
127 127
 
128
-   /**
129
-    * Whether to URL encode any non-encoded UTF8 characters in the URL.
130
-    * Default is to leave them as-is for better readability, since 
131
-    * browsers handle this well.
132
-    * 
133
-    * @param bool $enabled
134
-    * @return URLInfo
135
-    */
128
+    /**
129
+     * Whether to URL encode any non-encoded UTF8 characters in the URL.
130
+     * Default is to leave them as-is for better readability, since 
131
+     * browsers handle this well.
132
+     * 
133
+     * @param bool $enabled
134
+     * @return URLInfo
135
+     */
136 136
     public function setUTFEncoding(bool $enabled=true) : URLInfo
137 137
     {
138 138
         if($this->encodeUTFChars !== $enabled)
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
         return $this->encodeUTFChars;
150 150
     }
151 151
     
152
-   /**
153
-    * Filters a URL: removes control characters and the
154
-    * like to have a clean URL to work with.
155
-    * 
156
-    * @param string $url
157
-    * @return string
158
-    */
152
+    /**
153
+     * Filters a URL: removes control characters and the
154
+     * like to have a clean URL to work with.
155
+     * 
156
+     * @param string $url
157
+     * @return string
158
+     */
159 159
     public static function filterURL(string $url) : string
160 160
     {
161 161
         return URIFilter::filter($url);
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
         return $this->info['type'] === self::TYPE_PHONE;
186 186
     }
187 187
     
188
-   /**
189
-    * Whether the URL is a regular URL, not one of the 
190
-    * other types like a phone number or email address.
191
-    * 
192
-    * @return bool
193
-    */
188
+    /**
189
+     * Whether the URL is a regular URL, not one of the 
190
+     * other types like a phone number or email address.
191
+     * 
192
+     * @return bool
193
+     */
194 194
     public function isURL() : bool
195 195
     {
196 196
         $host = $this->getHost();
@@ -202,20 +202,20 @@  discard block
 block discarded – undo
202 202
         return $this->parser->isValid();
203 203
     }
204 204
     
205
-   /**
206
-    * Retrieves the host name, or an empty string if none is present.
207
-    * 
208
-    * @return string
209
-    */
205
+    /**
206
+     * Retrieves the host name, or an empty string if none is present.
207
+     * 
208
+     * @return string
209
+     */
210 210
     public function getHost() : string
211 211
     {
212 212
         return $this->getInfoKey('host');
213 213
     }
214 214
     
215
-   /**
216
-    * Retrieves the path, or an empty string if none is present.
217
-    * @return string
218
-    */
215
+    /**
216
+     * Retrieves the path, or an empty string if none is present.
217
+     * @return string
218
+     */
219 219
     public function getPath() : string
220 220
     {
221 221
         return $this->getInfoKey('path');
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
         return $this->getInfoKey('scheme');
232 232
     }
233 233
     
234
-   /**
235
-    * Retrieves the port specified in the URL, or -1 if none is present.
236
-    * @return int
237
-    */
234
+    /**
235
+     * Retrieves the port specified in the URL, or -1 if none is present.
236
+     * @return int
237
+     */
238 238
     public function getPort() : int
239 239
     {
240 240
         $port = $this->getInfoKey('port');
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
         return -1;
247 247
     }
248 248
     
249
-   /**
250
-    * Retrieves the raw query string, or an empty string if none is present.
251
-    * 
252
-    * @return string
253
-    * 
254
-    * @see URLInfo::getParams()
255
-    */
249
+    /**
250
+     * Retrieves the raw query string, or an empty string if none is present.
251
+     * 
252
+     * @return string
253
+     * 
254
+     * @see URLInfo::getParams()
255
+     */
256 256
     public function getQuery() : string
257 257
     {
258 258
         return $this->getInfoKey('query');
@@ -268,20 +268,20 @@  discard block
 block discarded – undo
268 268
         return $this->getInfoKey('pass');
269 269
     }
270 270
     
271
-   /**
272
-    * Whether the URL contains a port number.
273
-    * @return bool
274
-    */
271
+    /**
272
+     * Whether the URL contains a port number.
273
+     * @return bool
274
+     */
275 275
     public function hasPort() : bool
276 276
     {
277 277
         return $this->getPort() !== -1;
278 278
     }
279 279
     
280
-   /**
281
-    * Alias for the hasParams() method.
282
-    * @return bool
283
-    * @see URLInfo::hasParams()
284
-    */
280
+    /**
281
+     * Alias for the hasParams() method.
282
+     * @return bool
283
+     * @see URLInfo::hasParams()
284
+     */
285 285
     public function hasQuery() : bool
286 286
     {
287 287
         return $this->hasParams();
@@ -326,23 +326,23 @@  discard block
 block discarded – undo
326 326
         return '';
327 327
     }
328 328
 
329
-   /**
330
-    * Retrieves a normalized URL: this ensures that all parameters
331
-    * in the URL are always in the same order.
332
-    * 
333
-    * @return string
334
-    */
329
+    /**
330
+     * Retrieves a normalized URL: this ensures that all parameters
331
+     * in the URL are always in the same order.
332
+     * 
333
+     * @return string
334
+     */
335 335
     public function getNormalized() : string
336 336
     {
337 337
         return $this->normalize();
338 338
     }
339 339
     
340
-   /**
341
-    * Like getNormalized(), but if a username and password are present
342
-    * in the URL, returns the URL without them.
343
-    * 
344
-    * @return string
345
-    */
340
+    /**
341
+     * Like getNormalized(), but if a username and password are present
342
+     * in the URL, returns the URL without them.
343
+     * 
344
+     * @return string
345
+     */
346 346
     public function getNormalizedWithoutAuth() : string
347 347
     {
348 348
         return $this->normalize(false);
@@ -363,25 +363,25 @@  discard block
 block discarded – undo
363 363
         return $this->normalizer->normalize();
364 364
     }
365 365
     
366
-   /**
367
-    * Creates a hash of the URL, which can be used for comparisons.
368
-    * Since any parameters in the URL's query are sorted alphabetically,
369
-    * the same links with a different parameter order will have the 
370
-    * same hash.
371
-    * 
372
-    * @return string
373
-    */
366
+    /**
367
+     * Creates a hash of the URL, which can be used for comparisons.
368
+     * Since any parameters in the URL's query are sorted alphabetically,
369
+     * the same links with a different parameter order will have the 
370
+     * same hash.
371
+     * 
372
+     * @return string
373
+     */
374 374
     public function getHash() : string
375 375
     {
376 376
         return ConvertHelper::string2shortHash($this->getNormalized());
377 377
     }
378 378
 
379
-   /**
380
-    * Highlights the URL using HTML tags with specific highlighting
381
-    * class names.
382
-    * 
383
-    * @return string Will return an empty string if the URL is not valid.
384
-    */
379
+    /**
380
+     * Highlights the URL using HTML tags with specific highlighting
381
+     * class names.
382
+     * 
383
+     * @return string Will return an empty string if the URL is not valid.
384
+     */
385 385
     public function getHighlighted() : string
386 386
     {
387 387
         if(!$this->isValid()) {
@@ -413,15 +413,15 @@  discard block
 block discarded – undo
413 413
         return count($params);
414 414
     }
415 415
     
416
-   /**
417
-    * Retrieves all parameters specified in the url,
418
-    * if any, as an associative array. 
419
-    * 
420
-    * NOTE: Ignores parameters that have been added
421
-    * to the excluded parameters list.
422
-    *
423
-    * @return array<string,string>
424
-    */
416
+    /**
417
+     * Retrieves all parameters specified in the url,
418
+     * if any, as an associative array. 
419
+     * 
420
+     * NOTE: Ignores parameters that have been added
421
+     * to the excluded parameters list.
422
+     *
423
+     * @return array<string,string>
424
+     */
425 425
     public function getParams() : array
426 426
     {
427 427
         if(!$this->paramExclusion || empty($this->excludedParams)) {
@@ -439,37 +439,37 @@  discard block
 block discarded – undo
439 439
         return $keep;
440 440
     }
441 441
     
442
-   /**
443
-    * Retrieves the names of all parameters present in the URL, if any.
444
-    * @return string[]
445
-    */
442
+    /**
443
+     * Retrieves the names of all parameters present in the URL, if any.
444
+     * @return string[]
445
+     */
446 446
     public function getParamNames() : array
447 447
     {
448 448
         $params = $this->getParams();
449 449
         return array_keys($params);
450 450
     }
451 451
     
452
-   /**
453
-    * Retrieves a specific parameter value from the URL.
454
-    * 
455
-    * @param string $name
456
-    * @return string The parameter value, or an empty string if it does not exist.
457
-    */
452
+    /**
453
+     * Retrieves a specific parameter value from the URL.
454
+     * 
455
+     * @param string $name
456
+     * @return string The parameter value, or an empty string if it does not exist.
457
+     */
458 458
     public function getParam(string $name) : string
459 459
     {
460 460
         return $this->info['params'][$name] ?? '';
461 461
     }
462 462
     
463
-   /**
464
-    * Excludes a URL parameter entirely if present:
465
-    * the parser will act as if the parameter was not
466
-    * even present in the source URL, effectively
467
-    * stripping it.
468
-    *
469
-    * @param string $name
470
-    * @param string $reason A human-readable explanation why this is excluded - used when highlighting links.
471
-    * @return URLInfo
472
-    */
463
+    /**
464
+     * Excludes a URL parameter entirely if present:
465
+     * the parser will act as if the parameter was not
466
+     * even present in the source URL, effectively
467
+     * stripping it.
468
+     *
469
+     * @param string $name
470
+     * @param string $reason A human-readable explanation why this is excluded - used when highlighting links.
471
+     * @return URLInfo
472
+     */
473 473
     public function excludeParam(string $name, string $reason='') : URLInfo
474 474
     {
475 475
         if(!isset($this->excludedParams[$name]))
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
         return self::$typeLabels[$this->getType()];
523 523
     }
524 524
 
525
-   /**
526
-    * Whether excluded parameters should be highlighted in
527
-    * a different color in the URL when using the
528
-    * {@link URLInfo::getHighlighted()} method.
529
-    *
530
-    * @param bool $highlight
531
-    * @return URLInfo
532
-    */
525
+    /**
526
+     * Whether excluded parameters should be highlighted in
527
+     * a different color in the URL when using the
528
+     * {@link URLInfo::getHighlighted()} method.
529
+     *
530
+     * @param bool $highlight
531
+     * @return URLInfo
532
+     */
533 533
     public function setHighlightExcluded(bool $highlight=true) : URLInfo
534 534
     {
535 535
         $this->highlightExcluded = $highlight;
@@ -585,24 +585,24 @@  discard block
 block discarded – undo
585 585
         return $this;
586 586
     }
587 587
     
588
-   /**
589
-    * Whether the parameter exclusion mode is enabled:
590
-    * In this case, if any parameters have been added to the
591
-    * exclusion list, all relevant methods will exclude these.
592
-    *
593
-    * @return bool
594
-    */
588
+    /**
589
+     * Whether the parameter exclusion mode is enabled:
590
+     * In this case, if any parameters have been added to the
591
+     * exclusion list, all relevant methods will exclude these.
592
+     *
593
+     * @return bool
594
+     */
595 595
     public function isParamExclusionEnabled() : bool
596 596
     {
597 597
         return $this->paramExclusion;
598 598
     }
599 599
     
600
-   /**
601
-    * Checks whether the link contains any parameters that
602
-    * are on the list of excluded parameters.
603
-    *
604
-    * @return bool
605
-    */
600
+    /**
601
+     * Checks whether the link contains any parameters that
602
+     * are on the list of excluded parameters.
603
+     *
604
+     * @return bool
605
+     */
606 606
     public function containsExcludedParams() : bool
607 607
     {
608 608
         if(empty($this->excludedParams)) {
@@ -690,26 +690,26 @@  discard block
 block discarded – undo
690 690
             ->canConnect();
691 691
     }
692 692
     
693
-   /**
694
-    * Creates the connection tester instance that is used
695
-    * to check if a URL can be connected to, and which is
696
-    * used in the {@see URLInfo::tryConnect()} method. It
697
-    * allows more settings to be used.
698
-    * 
699
-    * @return URIConnectionTester
700
-    */
693
+    /**
694
+     * Creates the connection tester instance that is used
695
+     * to check if a URL can be connected to, and which is
696
+     * used in the {@see URLInfo::tryConnect()} method. It
697
+     * allows more settings to be used.
698
+     * 
699
+     * @return URIConnectionTester
700
+     */
701 701
     public function createConnectionTester() : URIConnectionTester
702 702
     {
703 703
         return new URIConnectionTester($this);
704 704
     }
705 705
     
706
-   /**
707
-    * Adds/overwrites a URL parameter.
708
-    *  
709
-    * @param string $name
710
-    * @param string $val
711
-    * @return URLInfo
712
-    */
706
+    /**
707
+     * Adds/overwrites a URL parameter.
708
+     *  
709
+     * @param string $name
710
+     * @param string $val
711
+     * @return URLInfo
712
+     */
713 713
     public function setParam(string $name, string $val) : URLInfo
714 714
     {
715 715
         $this->info['params'][$name] = $val;
@@ -717,13 +717,13 @@  discard block
 block discarded – undo
717 717
         return $this;
718 718
     }
719 719
     
720
-   /**
721
-    * Removes a URL parameter. Has no effect if the
722
-    * parameter is not present to begin with.
723
-    * 
724
-    * @param string $param
725
-    * @return URLInfo
726
-    */
720
+    /**
721
+     * Removes a URL parameter. Has no effect if the
722
+     * parameter is not present to begin with.
723
+     * 
724
+     * @param string $param
725
+     * @return URLInfo
726
+     */
727 727
     public function removeParam(string $param) : URLInfo
728 728
     {
729 729
         if(isset($this->info['params'][$param]))
Please login to merge, or discard this patch.