Passed
Push — master ( ba00c7...bfa3fc )
by Sebastian
08:42
created
src/Highlighter.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -43,60 +43,60 @@  discard block
 block discarded – undo
43 43
  */
44 44
 class Highlighter
45 45
 {
46
-   /**
47
-    * Creates a new GeSHi instance from a source code string.
48
-    * 
49
-    * @param string $sourceCode
50
-    * @param string $format
51
-    * @return GeSHi
52
-    */
46
+    /**
47
+     * Creates a new GeSHi instance from a source code string.
48
+     * 
49
+     * @param string $sourceCode
50
+     * @param string $format
51
+     * @return GeSHi
52
+     */
53 53
     public static function fromString(string $sourceCode, string $format) : GeSHi
54 54
     {
55 55
         return new GeSHi($sourceCode, $format);
56 56
     }
57 57
     
58
-   /**
59
-    * Creates a new GeSHi instance from the contents of a file.
60
-    * 
61
-    * @param string $path
62
-    * @param string $format
63
-    * @return GeSHi
64
-    */
58
+    /**
59
+     * Creates a new GeSHi instance from the contents of a file.
60
+     * 
61
+     * @param string $path
62
+     * @param string $format
63
+     * @return GeSHi
64
+     */
65 65
     public static function fromFile(string $path, string $format) : GeSHi
66 66
     {
67 67
         return self::fromString(FileHelper::readContents($path), $format);
68 68
     }
69 69
     
70
-   /**
71
-    * Parses and highlights the target string.
72
-    * 
73
-    * @param string $sourceCode
74
-    * @param string $format
75
-    * @return string
76
-    */
70
+    /**
71
+     * Parses and highlights the target string.
72
+     * 
73
+     * @param string $sourceCode
74
+     * @param string $format
75
+     * @return string
76
+     */
77 77
     public static function parseString(string $sourceCode, string $format) : string
78 78
     {
79 79
         return self::fromString($sourceCode, $format)->parse_code();
80 80
     }
81 81
     
82
-   /**
83
-    * Parses and highlights the contents of the target file.
84
-    * 
85
-    * @param string $path
86
-    * @param string $format
87
-    * @return string
88
-    */
82
+    /**
83
+     * Parses and highlights the contents of the target file.
84
+     * 
85
+     * @param string $path
86
+     * @param string $format
87
+     * @return string
88
+     */
89 89
     public static function parseFile(string $path, string $format) : string
90 90
     {
91 91
         return self::fromFile($path, $format)->parse_code();
92 92
     }
93 93
     
94
-   /**
95
-    * Adds HTML syntax highlighting to the specified SQL string.
96
-    *
97
-    * @param string $sql
98
-    * @return string
99
-    */
94
+    /**
95
+     * Adds HTML syntax highlighting to the specified SQL string.
96
+     *
97
+     * @param string $sql
98
+     * @return string
99
+     */
100 100
     public static function sql(string $sql) : string
101 101
     {
102 102
         return self::parseString($sql, 'sql');
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
         return self::parseString($subject, 'javascript');
123 123
     }
124 124
     
125
-   /**
126
-    * Adds HTML syntax highlighting to the specified XML code.
127
-    *
128
-    * @param string $xml The XML to highlight.
129
-    * @param bool $formatSource Whether to format the source with indentation to make it readable.
130
-    * @return string
131
-    */
125
+    /**
126
+     * Adds HTML syntax highlighting to the specified XML code.
127
+     *
128
+     * @param string $xml The XML to highlight.
129
+     * @param bool $formatSource Whether to format the source with indentation to make it readable.
130
+     * @return string
131
+     */
132 132
     public static function xml(string $xml, bool $formatSource=false) : string
133 133
     {
134 134
         if($formatSource)
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
         return self::parseString($xml, 'xml');
146 146
     }
147 147
     
148
-   /**
149
-    * Adds HTML syntax highlighting to the specified HTML code.
150
-    * 
151
-    * @param string $html
152
-    * @param bool $formatSource
153
-    * @return string
154
-    */
148
+    /**
149
+     * Adds HTML syntax highlighting to the specified HTML code.
150
+     * 
151
+     * @param string $html
152
+     * @param bool $formatSource
153
+     * @return string
154
+     */
155 155
     public static function html(string $html, bool $formatSource=false) : string
156 156
     {
157 157
         if($formatSource)
@@ -168,27 +168,27 @@  discard block
 block discarded – undo
168 168
         return self::parseString($html, 'xml');
169 169
     }
170 170
     
171
-   /**
172
-    * Adds HTML syntax highlighting to a bit of PHP code.
173
-    * 
174
-    * @param string $phpCode
175
-    * @return string
176
-    */
171
+    /**
172
+     * Adds HTML syntax highlighting to a bit of PHP code.
173
+     * 
174
+     * @param string $phpCode
175
+     * @return string
176
+     */
177 177
     public static function php(string $phpCode) : string
178 178
     {
179 179
         return self::parseString($phpCode, 'php');
180 180
     }
181 181
     
182
-   /**
183
-    * Adds HTML syntax highlighting to an URL.
184
-    *
185
-    * NOTE: Includes the necessary CSS styles. When
186
-    * highlighting several URLs in the same page,
187
-    * prefer using the `parseURL` function instead.
188
-    *
189
-    * @param string $url
190
-    * @return string
191
-    */
182
+    /**
183
+     * Adds HTML syntax highlighting to an URL.
184
+     *
185
+     * NOTE: Includes the necessary CSS styles. When
186
+     * highlighting several URLs in the same page,
187
+     * prefer using the `parseURL` function instead.
188
+     *
189
+     * @param string $url
190
+     * @return string
191
+     */
192 192
     public static function url(string $url) : string
193 193
     {
194 194
         $info = parseURL($url);
Please login to merge, or discard this patch.
src/XMLHelper/Converter.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
     
52 52
     protected SimpleXMLElement $xml;
53 53
     
54
-   /**
55
-    * @var string|NULL
56
-    */
54
+    /**
55
+     * @var string|NULL
56
+     */
57 57
     protected ?string $json;
58 58
     
59 59
     protected function __construct(SimpleXMLElement $element)
@@ -98,34 +98,34 @@  discard block
 block discarded – undo
98 98
         }
99 99
     }
100 100
     
101
-   /**
102
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
103
-    * 
104
-    * @param SimpleXMLElement $element
105
-    * @return XMLHelper_Converter
106
-    */
101
+    /**
102
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
103
+     * 
104
+     * @param SimpleXMLElement $element
105
+     * @return XMLHelper_Converter
106
+     */
107 107
     public static function fromElement(SimpleXMLElement $element) : XMLHelper_Converter
108 108
     {
109 109
         return new XMLHelper_Converter($element);
110 110
     }
111 111
 
112
-   /**
113
-    * Factory method: creates a converter from an existing SimpleXMLElement instance.
114
-    *
115
-    * @param DOMElement $element
116
-    * @return XMLHelper_Converter
117
-    */
112
+    /**
113
+     * Factory method: creates a converter from an existing SimpleXMLElement instance.
114
+     *
115
+     * @param DOMElement $element
116
+     * @return XMLHelper_Converter
117
+     */
118 118
     public static function fromDOMElement(DOMElement $element) : XMLHelper_Converter
119 119
     {
120 120
         return new XMLHelper_Converter(simplexml_import_dom($element));
121 121
     }
122 122
     
123
-   /**
124
-    * Converts the XML to JSON.
125
-    * 
126
-    * @return string
127
-    * @throws XMLHelper_Exception
128
-    */
123
+    /**
124
+     * Converts the XML to JSON.
125
+     * 
126
+     * @return string
127
+     * @throws XMLHelper_Exception
128
+     */
129 129
     public function toJSON() : string
130 130
     {
131 131
         if (isset($this->json))
Please login to merge, or discard this patch.
src/JSHelper.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
     public const JS_REGEX_JSON = 'json';
39 39
 
40 40
     /**
41
-    * @var array<string,string>
42
-    */
41
+     * @var array<string,string>
42
+     */
43 43
     protected static array $variableCache = array();
44 44
     protected static int $elementCounter = 0;
45 45
     protected static string $idPrefix = 'E';
46 46
     
47
-   /**
48
-    * Builds a javascript statement. The first parameter is the
49
-    * javascript function to call, any additional parameters are
50
-    * used as arguments for the javascript function call. Variable
51
-    * types are automagically converted to the javascript equivalents.
52
-    *
53
-    * Examples:
54
-    *
55
-    * // add an alert(); statement:
56
-    * JSHelper::buildStatement('alert');
57
-    *
58
-    * // add an alert('Alert text'); statement
59
-    * JSHelper::buildStatement('alert', 'Alert text');
60
-    *
61
-    */
47
+    /**
48
+     * Builds a javascript statement. The first parameter is the
49
+     * javascript function to call, any additional parameters are
50
+     * used as arguments for the javascript function call. Variable
51
+     * types are automagically converted to the javascript equivalents.
52
+     *
53
+     * Examples:
54
+     *
55
+     * // add an alert(); statement:
56
+     * JSHelper::buildStatement('alert');
57
+     *
58
+     * // add an alert('Alert text'); statement
59
+     * JSHelper::buildStatement('alert', 'Alert text');
60
+     *
61
+     */
62 62
     public static function buildStatement() : string
63 63
     {
64 64
         $args = func_get_args();
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
         return call_user_func_array(array(self::class, 'buildStatementQuoteStyle'), $args);
67 67
     }
68 68
     
69
-   /**
70
-    * Like {@link JSHelper::buildStatement()}, but using single quotes
71
-    * to make it possible to use the statement in an HTML tag attribute.
72
-    * 
73
-    * @return string
74
-    * @see JSHelper::buildStatement()
75
-    */
69
+    /**
70
+     * Like {@link JSHelper::buildStatement()}, but using single quotes
71
+     * to make it possible to use the statement in an HTML tag attribute.
72
+     * 
73
+     * @return string
74
+     * @see JSHelper::buildStatement()
75
+     */
76 76
     public static function buildStatementAttribute() : string
77 77
     {
78 78
         $args = func_get_args();
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
         return self::phpVariable2JS($variable, self::QUOTE_STYLE_SINGLE);
226 226
     }
227 227
 
228
-   /**
229
-    * Generates a dynamic element ID to be used with dynamically generated
230
-    * HTML code to tie in with clientside javascript when compact but unique
231
-    * IDs are needed in a  request.
232
-    *
233
-    * @return string
234
-    */
228
+    /**
229
+     * Generates a dynamic element ID to be used with dynamically generated
230
+     * HTML code to tie in with clientside javascript when compact but unique
231
+     * IDs are needed in a  request.
232
+     *
233
+     * @return string
234
+     */
235 235
     public static function nextElementID() : string
236 236
     {
237 237
         self::$elementCounter++;
@@ -239,33 +239,33 @@  discard block
 block discarded – undo
239 239
         return self::$idPrefix . self::$elementCounter;
240 240
     }
241 241
     
242
-   /**
243
-    * Retrieves the ID prefix currently used.
244
-    * 
245
-    * @return string
246
-    */
242
+    /**
243
+     * Retrieves the ID prefix currently used.
244
+     * 
245
+     * @return string
246
+     */
247 247
     public static function getIDPrefix() : string
248 248
     {
249 249
         return self::$idPrefix;
250 250
     }
251 251
     
252
-   /**
253
-    * Retrieves the value of the internal elements counter.
254
-    * 
255
-    * @return integer
256
-    */
252
+    /**
253
+     * Retrieves the value of the internal elements counter.
254
+     * 
255
+     * @return integer
256
+     */
257 257
     public static function getElementCounter() : int
258 258
     {
259 259
         return self::$elementCounter;
260 260
     }
261 261
     
262
-   /**
263
-    * Sets the prefix that is added in front of all IDs
264
-    * retrieved using the {@link nextElementID()} method.
265
-    * 
266
-    * @param string $prefix
267
-    * @see JSHelper::nextElementID()
268
-    */
262
+    /**
263
+     * Sets the prefix that is added in front of all IDs
264
+     * retrieved using the {@link nextElementID()} method.
265
+     * 
266
+     * @param string $prefix
267
+     * @see JSHelper::nextElementID()
268
+     */
269 269
     public static function setIDPrefix(string $prefix) : void
270 270
     {
271 271
         self::$idPrefix = $prefix;
Please login to merge, or discard this patch.
src/ZIPHelper.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         'WriteThreshold' => 100
41 41
     );
42 42
     
43
-   /**
44
-    * @var string
45
-    */
43
+    /**
44
+     * @var string
45
+     */
46 46
     protected $file;
47 47
     
48
-   /**
49
-    * @var ZipArchive|NULL
50
-    */
48
+    /**
49
+     * @var ZipArchive|NULL
50
+     */
51 51
     protected $zip;
52 52
 
53 53
     protected bool $open = false;
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
         $this->file = $targetFile;
58 58
     }
59 59
     
60
-   /**
61
-    * Sets an option, among the available options:
62
-    * 
63
-    * <ul>
64
-    * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li>
65
-    * </ul>
66
-    * 
67
-    * @param string $name
68
-    * @param mixed $value
69
-    * @return ZIPHelper
70
-    */
60
+    /**
61
+     * Sets an option, among the available options:
62
+     * 
63
+     * <ul>
64
+     * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li>
65
+     * </ul>
66
+     * 
67
+     * @param string $name
68
+     * @param mixed $value
69
+     * @return ZIPHelper
70
+     */
71 71
     public function setOption(string $name, $value) : ZIPHelper
72 72
     {
73 73
         $this->options[$name] = $value;
74 74
         return $this;
75 75
     }
76 76
     
77
-   /**
78
-    * Adds a file to the zip. By default, the file is stored
79
-    * with the same name in the root of the zip. Use the optional
80
-    * parameter to change the location in the zip.
81
-    * 
82
-    * @param string $filePath
83
-    * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root.
84
-    * @throws ZIPHelper_Exception
85
-    * @return bool
86
-    * 
87
-    * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
88
-    */
77
+    /**
78
+     * Adds a file to the zip. By default, the file is stored
79
+     * with the same name in the root of the zip. Use the optional
80
+     * parameter to change the location in the zip.
81
+     * 
82
+     * @param string $filePath
83
+     * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root.
84
+     * @throws ZIPHelper_Exception
85
+     * @return bool
86
+     * 
87
+     * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
88
+     */
89 89
     public function addFile(string $filePath, ?string $zipPath=null) : bool
90 90
     {
91 91
         $this->open();
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<string,mixed>
100
-    */
95
+    /**
96
+     * Retrieves the array as parsed by PHP's parse_url,
97
+     * filtered and adjusted as necessary.
98
+     * 
99
+     * @return array<string,mixed>
100
+     */
101 101
     public function getInfo() : array
102 102
     {
103 103
         return $this->info;
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
         $this->url = implode(':', $parts);
154 154
     }
155 155
 
156
-   /**
157
-    * Finds any non-url encoded unicode characters in 
158
-    * the URL, and encodes them before the URL is 
159
-    * passed to parse_url.
160
-    */
156
+    /**
157
+     * Finds any non-url encoded unicode characters in 
158
+     * the URL, and encodes them before the URL is 
159
+     * passed to parse_url.
160
+     */
161 161
     protected function filterUnicodeChars() : void
162 162
     {
163 163
         $chars = ConvertHelper::string2array($this->url);
@@ -228,23 +228,23 @@  discard block
 block discarded – undo
228 228
         $this->isValid = true;
229 229
     }
230 230
 
231
-   /**
232
-    * Goes through all information in the parse_url result
233
-    * array, and attempts to fix any user errors in formatting
234
-    * that can be recovered from, mostly regarding stray spaces.
235
-    */
231
+    /**
232
+     * Goes through all information in the parse_url result
233
+     * array, and attempts to fix any user errors in formatting
234
+     * that can be recovered from, mostly regarding stray spaces.
235
+     */
236 236
     protected function filterParsed() : void
237 237
     {
238 238
         $this->info = (new ParsedInfoFilter($this->url, $this->info))->filter();
239 239
     }
240 240
     
241
-   /**
242
-    * Recursively goes through the array, and converts all previously
243
-    * URL encoded characters with their unicode character counterparts.
244
-    * 
245
-    * @param array<string,mixed> $subject
246
-    * @return array<string,mixed>
247
-    */
241
+    /**
242
+     * Recursively goes through the array, and converts all previously
243
+     * URL encoded characters with their unicode character counterparts.
244
+     * 
245
+     * @param array<string,mixed> $subject
246
+     * @return array<string,mixed>
247
+     */
248 248
     protected function restoreUnicodeChars(array $subject) : array
249 249
     {
250 250
         $result = array();
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
         return $result;
269 269
     }
270 270
     
271
-   /**
272
-    * Replaces all URL encoded unicode characters
273
-    * in the string with the unicode character.
274
-    * 
275
-    * @param string $string
276
-    * @return string
277
-    */
271
+    /**
272
+     * Replaces all URL encoded unicode characters
273
+     * in the string with the unicode character.
274
+     * 
275
+     * @param string $string
276
+     * @return string
277
+     */
278 278
     protected function restoreUnicodeChar(string $string) : string
279 279
     {
280 280
         if(strpos($string, '%') !== false)
@@ -295,32 +295,32 @@  discard block
 block discarded – undo
295 295
         );
296 296
     }
297 297
    
298
-   /**
299
-    * Checks whether the URL that was parsed is valid.
300
-    * @return bool
301
-    */
298
+    /**
299
+     * Checks whether the URL that was parsed is valid.
300
+     * @return bool
301
+     */
302 302
     public function isValid() : bool
303 303
     {
304 304
         return $this->isValid;
305 305
     }
306 306
 
307
-   /**
308
-    * If the validation failed, retrieves the validation
309
-    * error message.
310
-    * 
311
-    * @return string
312
-    */
307
+    /**
308
+     * If the validation failed, retrieves the validation
309
+     * error message.
310
+     * 
311
+     * @return string
312
+     */
313 313
     public function getErrorMessage() : string
314 314
     {
315 315
         return $this->error['message'] ?? '';
316 316
     }
317 317
     
318
-   /**
319
-    * If the validation failed, retrieves the validation
320
-    * error code.
321
-    * 
322
-    * @return int
323
-    */
318
+    /**
319
+     * If the validation failed, retrieves the validation
320
+     * error code.
321
+     * 
322
+     * @return int
323
+     */
324 324
     public function getErrorCode() : int
325 325
     {
326 326
         return $this->error['code'] ?? -1;
Please login to merge, or discard this patch.