Passed
Push — master ( d3f706...95ff55 )
by Sebastian
08:48
created
src/Request/Param/Validator/Url.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
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
         
Please login to merge, or discard this patch.
src/Request/Param/Validator/Json.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,13 +50,11 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Request/Param/Validator/Numeric.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
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
         
Please login to merge, or discard this patch.
src/URLInfo/Parser/ParsedInfoFilter.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/URLInfo/URIParser.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         // if the URL contains any URL characters, and we
115 115
         // do not want them URL encoded, restore them.
116
-        if(!$this->encodeUTF && !empty($this->unicodeChars))
116
+        if (!$this->encodeUTF && !empty($this->unicodeChars))
117 117
         {
118 118
             $this->info = $this->restoreUnicodeChars($this->info);
119 119
         }
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
         
131 131
         $keep = array();
132 132
         
133
-        foreach($chars as $char)
133
+        foreach ($chars as $char)
134 134
         {
135
-            if(preg_match('/\p{L}/uix', $char))
135
+            if (preg_match('/\p{L}/uix', $char))
136 136
             {
137 137
                 $encoded = rawurlencode($char);
138 138
                 
139
-                if($encoded !== $char)
139
+                if ($encoded !== $char)
140 140
                 {
141 141
                     $this->unicodeChars[$encoded] = $char;
142 142
                     $char = $encoded;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
     protected function detectType() : bool
153 153
     {
154
-        foreach(self::$detectorClasses as $className)
154
+        foreach (self::$detectorClasses as $className)
155 155
         {
156 156
             $detector = ClassHelper::requireObjectInstanceOf(
157 157
                 BaseURLTypeDetector::class,
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             // Use the adjusted data
164 164
             $this->info = $detector->getInfo();
165 165
 
166
-            if($detected) {
166
+            if ($detected) {
167 167
                 $this->isValid = true;
168 168
                 return true;
169 169
             }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
     protected function validate() : void
176 176
     {
177
-        foreach(self::$validatorClasses as $validatorClass)
177
+        foreach (self::$validatorClasses as $validatorClass)
178 178
         {
179 179
             $validator = ClassHelper::requireObjectInstanceOf(
180 180
                 BaseURLValidator::class,
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
             $this->info = $validator->getInfo();
187 187
 
188
-            if($result !== true) {
188
+            if ($result !== true) {
189 189
                 $this->isValid = false;
190 190
                 return;
191 191
             }
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $result = array();
217 217
         
218
-        foreach($subject as $key => $val)
218
+        foreach ($subject as $key => $val)
219 219
         {
220
-            if(is_array($val))
220
+            if (is_array($val))
221 221
             {
222 222
                 $val = $this->restoreUnicodeChars($val);
223 223
             }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     */
244 244
     protected function restoreUnicodeChar(string $string) : string
245 245
     {
246
-        if(strpos($string, '%') !== false)
246
+        if (strpos($string, '%') !== false)
247 247
         {
248 248
             return str_replace(array_keys($this->unicodeChars), array_values($this->unicodeChars), $string);
249 249
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -285,8 +285,7 @@
 block discarded – undo
285 285
             if(is_array($val))
286 286
             {
287 287
                 $val = $this->restoreUnicodeChars($val);
288
-            }
289
-            else
288
+            } else
290 289
             {
291 290
                 $val = $this->restoreUnicodeChar($val);
292 291
             }
Please login to merge, or discard this 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;
@@ -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,23 +194,23 @@  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 = (new ParsedInfoFilter($this->url, $this->info))->filter();
205 205
     }
206 206
     
207
-   /**
208
-    * Recursively goes through the array, and converts all previously
209
-    * URL encoded characters with their unicode character counterparts.
210
-    * 
211
-    * @param array<string,mixed> $subject
212
-    * @return array<string,mixed>
213
-    */
207
+    /**
208
+     * Recursively goes through the array, and converts all previously
209
+     * URL encoded characters with their unicode character counterparts.
210
+     * 
211
+     * @param array<string,mixed> $subject
212
+     * @return array<string,mixed>
213
+     */
214 214
     protected function restoreUnicodeChars(array $subject) : array
215 215
     {
216 216
         $result = array();
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
         return $result;
235 235
     }
236 236
     
237
-   /**
238
-    * Replaces all URL encoded unicode characters
239
-    * in the string with the unicode character.
240
-    * 
241
-    * @param string $string
242
-    * @return string
243
-    */
237
+    /**
238
+     * Replaces all URL encoded unicode characters
239
+     * in the string with the unicode character.
240
+     * 
241
+     * @param string $string
242
+     * @return string
243
+     */
244 244
     protected function restoreUnicodeChar(string $string) : string
245 245
     {
246 246
         if(strpos($string, '%') !== false)
@@ -261,32 +261,32 @@  discard block
 block discarded – undo
261 261
         );
262 262
     }
263 263
    
264
-   /**
265
-    * Checks whether the URL that was parsed is valid.
266
-    * @return bool
267
-    */
264
+    /**
265
+     * Checks whether the URL that was parsed is valid.
266
+     * @return bool
267
+     */
268 268
     public function isValid() : bool
269 269
     {
270 270
         return $this->isValid;
271 271
     }
272 272
 
273
-   /**
274
-    * If the validation failed, retrieves the validation
275
-    * error message.
276
-    * 
277
-    * @return string
278
-    */
273
+    /**
274
+     * If the validation failed, retrieves the validation
275
+     * error message.
276
+     * 
277
+     * @return string
278
+     */
279 279
     public function getErrorMessage() : string
280 280
     {
281 281
         return $this->error['message'] ?? '';
282 282
     }
283 283
     
284
-   /**
285
-    * If the validation failed, retrieves the validation
286
-    * error code.
287
-    * 
288
-    * @return int
289
-    */
284
+    /**
285
+     * If the validation failed, retrieves the validation
286
+     * error code.
287
+     * 
288
+     * @return int
289
+     */
290 290
     public function getErrorCode() : int
291 291
     {
292 292
         return $this->error['code'] ?? -1;
Please login to merge, or discard this patch.
src/URLInfo/URLHosts.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public static function addHost(string $host) : void
19 19
     {
20
-        if(!self::isHostKnown($host)) {
20
+        if (!self::isHostKnown($host)) {
21 21
             self::$knownHosts[] = strtolower($host);
22 22
         }
23 23
     }
Please login to merge, or discard this patch.
src/URLInfo/Parser/URLTypeDetector/DetectEmail.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
 {
23 23
     public function detect() : bool
24 24
     {
25
-        if($this->getScheme() === 'mailto') {
25
+        if ($this->getScheme() === 'mailto') {
26 26
             $this->setHostFromEmail((string)$this->getPath());
27 27
             $this->setTypeEmail();
28 28
             return true;
29 29
         }
30 30
 
31
-        if($this->hasPath() && preg_match(RegexHelper::REGEX_EMAIL, $this->getPath()))
31
+        if ($this->hasPath() && preg_match(RegexHelper::REGEX_EMAIL, $this->getPath()))
32 32
         {
33 33
             $this->setHostFromEmail($this->getPath());
34 34
             $this->setSchemeMailto();
Please login to merge, or discard this patch.
src/XMLHelper.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
     private static bool $simulation = false;
35 35
     private DOMDocument $dom;
36 36
 
37
-   /**
38
-    * Creates a new XMLHelper instance.
39
-    * 
40
-    * @return XMLHelper
41
-    */
37
+    /**
38
+     * Creates a new XMLHelper instance.
39
+     * 
40
+     * @return XMLHelper
41
+     */
42 42
     public static function create() : XMLHelper
43 43
     {
44 44
         $dom = new DOMDocument('1.0', 'UTF-8');
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
         return XMLHelper_Converter::fromString($xmlString);
69 69
     }
70 70
 
71
-   /**
72
-    * Creates a converter from a SimpleXMLElement instance.
73
-    * @param SimpleXMLElement $element
74
-    * @return XMLHelper_Converter
75
-    */
71
+    /**
72
+     * Creates a converter from a SimpleXMLElement instance.
73
+     * @param SimpleXMLElement $element
74
+     * @return XMLHelper_Converter
75
+     */
76 76
     public static function convertElement(SimpleXMLElement $element) : XMLHelper_Converter
77 77
     {
78 78
         return XMLHelper_Converter::fromElement($element);
79 79
     }
80 80
    
81
-   /**
82
-    * Creates a converter from a DOMElement instance.
83
-    * @param DOMElement $element
84
-    * @return XMLHelper_Converter
85
-    */
81
+    /**
82
+     * Creates a converter from a DOMElement instance.
83
+     * @param DOMElement $element
84
+     * @return XMLHelper_Converter
85
+     */
86 86
     public static function convertDOMElement(DOMElement $element) : XMLHelper_Converter
87 87
     {
88 88
         return XMLHelper_Converter::fromDOMElement($element);
89 89
     }
90 90
 
91
-   /**
92
-    * Creates a new helper using an existing DOMDocument object.
93
-    * @param DOMDocument $dom
94
-    */
91
+    /**
92
+     * Creates a new helper using an existing DOMDocument object.
93
+     * @param DOMDocument $dom
94
+     */
95 95
     public function __construct(DOMDocument $dom)
96 96
     {
97 97
         $this->dom = $dom;
98 98
     }
99 99
 
100
-   /**
101
-    * @return DOMDocument
102
-    */
100
+    /**
101
+     * @return DOMDocument
102
+     */
103 103
     public function getDOM() : DOMDocument
104 104
     {
105 105
         return $this->dom;
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
         return $root;
300 300
     }
301 301
 
302
-   /**
303
-    * Escaped the string for use in XML.
304
-    * 
305
-    * @param string $string
306
-    * @return string
307
-    */
302
+    /**
303
+     * Escaped the string for use in XML.
304
+     * 
305
+     * @param string $string
306
+     * @return string
307
+     */
308 308
     public function escape(string $string) : string
309 309
     {
310 310
         return preg_replace('#<p>(.*)</p>#isUm', '$1', $string);
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
         );
332 332
     }
333 333
 
334
-   /**
335
-    * Sends the specified XML string to the browser with
336
-    * the correct headers to trigger a download of the XML
337
-    * to a local file.
338
-    * 
339
-    * NOTE: Ensure calling exit after this is done, and to
340
-    * not send additional content, which would corrupt the 
341
-    * download.
342
-    *
343
-    * @param string $xml
344
-    * @param string $filename
345
-    */
334
+    /**
335
+     * Sends the specified XML string to the browser with
336
+     * the correct headers to trigger a download of the XML
337
+     * to a local file.
338
+     * 
339
+     * NOTE: Ensure calling exit after this is done, and to
340
+     * not send additional content, which would corrupt the 
341
+     * download.
342
+     *
343
+     * @param string $xml
344
+     * @param string $filename
345
+     */
346 346
     public static function downloadXML(string $xml, string $filename = 'download.xml') : void
347 347
     {
348 348
         if(!self::$simulation && !headers_sent())
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
         echo $xml;
354 354
     }
355 355
 
356
-   /**
357
-    * Sends the specified XML string to the browser with
358
-    * the correct headers and terminates the request.
359
-    *
360
-    * @param string $xml
361
-    */
356
+    /**
357
+     * Sends the specified XML string to the browser with
358
+     * the correct headers and terminates the request.
359
+     *
360
+     * @param string $xml
361
+     */
362 362
     public static function displayXML(string $xml) : void
363 363
     {
364 364
         if(!self::$simulation && !headers_sent())
@@ -477,30 +477,30 @@  discard block
 block discarded – undo
477 477
         return $this->dom->saveXML();
478 478
     }
479 479
     
480
-   /**
481
-    * Creates a new SimpleXML helper instance: this
482
-    * object is useful to work with loading XML strings
483
-    * and files with easy access to any errors that 
484
-    * may occurr, since the simplexml functions can be
485
-    * somewhat cryptic.
486
-    * 
487
-    * @return XMLHelper_SimpleXML
488
-    */
480
+    /**
481
+     * Creates a new SimpleXML helper instance: this
482
+     * object is useful to work with loading XML strings
483
+     * and files with easy access to any errors that 
484
+     * may occurr, since the simplexml functions can be
485
+     * somewhat cryptic.
486
+     * 
487
+     * @return XMLHelper_SimpleXML
488
+     */
489 489
     public static function createSimplexml() : XMLHelper_SimpleXML
490 490
     {
491 491
         return new XMLHelper_SimpleXML();
492 492
     }
493 493
     
494
-   /**
495
-    * Converts a string to valid XML: can be a text only string
496
-    * or an HTML string. Returns valid XML code.
497
-    * 
498
-    * NOTE: The string may contain custom tags, which are 
499
-    * preserved.
500
-    * 
501
-    * @param string $string
502
-    * @return string
503
-    */
494
+    /**
495
+     * Converts a string to valid XML: can be a text only string
496
+     * or an HTML string. Returns valid XML code.
497
+     * 
498
+     * NOTE: The string may contain custom tags, which are 
499
+     * preserved.
500
+     * 
501
+     * @param string $string
502
+     * @return string
503
+     */
504 504
     public static function string2xml(string $string) : string
505 505
     {
506 506
         return XMLHelper_HTMLLoader::loadFragment($string)->fragmentToXML();
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function removeTag(DOMElement $tag) : void
162 162
     {
163
-        if(isset($tag->parentNode))
163
+        if (isset($tag->parentNode))
164 164
         {
165 165
             $tag->parentNode->removeChild($tag);
166 166
         }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
         if (!empty($text)) {
250 250
             $fragment = $this->dom->createDocumentFragment();
251
-            if(!@$fragment->appendXML($text)) {
251
+            if (!@$fragment->appendXML($text)) {
252 252
                 throw new XMLHelper_Exception(
253 253
                     'Cannot append XML fragment',
254 254
                     sprintf(
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      * @return DOMNode
293 293
      * @throws DOMException
294 294
      */
295
-    public function createRoot(string $name, array $attributes=array()) : DOMNode
295
+    public function createRoot(string $name, array $attributes = array()) : DOMNode
296 296
     {
297 297
         $root = $this->dom->appendChild($this->dom->createElement($name));
298 298
         $this->addAttributes($root, $attributes);
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
     */
346 346
     public static function downloadXML(string $xml, string $filename = 'download.xml') : void
347 347
     {
348
-        if(!self::$simulation && !headers_sent())
348
+        if (!self::$simulation && !headers_sent())
349 349
         {
350
-            header('Content-Disposition: attachment; filename="' . $filename . '"');
350
+            header('Content-Disposition: attachment; filename="'.$filename.'"');
351 351
         }
352 352
         
353 353
         echo $xml;
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
     */
362 362
     public static function displayXML(string $xml) : void
363 363
     {
364
-        if(!self::$simulation && !headers_sent())
364
+        if (!self::$simulation && !headers_sent())
365 365
         {
366 366
             header('Content-Type:text/xml; charset=utf-8');
367 367
         }
368 368
         
369
-        if(self::$simulation) 
369
+        if (self::$simulation) 
370 370
         {
371 371
             $xml = '<pre>'.htmlspecialchars($xml).'</pre>';
372 372
         }
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
      * @throws DOMException
386 386
      * @see buildErrorXML()
387 387
      */
388
-    public static function displayErrorXML($code, string $message, string $title, array $customInfo=array()) : void
388
+    public static function displayErrorXML($code, string $message, string $title, array $customInfo = array()) : void
389 389
     {
390
-        if(!self::$simulation && !headers_sent()) {
391
-            header('HTTP/1.1 400 Bad Request: ' . $title, true, 400);
390
+        if (!self::$simulation && !headers_sent()) {
391
+            header('HTTP/1.1 400 Bad Request: '.$title, true, 400);
392 392
         }
393 393
 
394 394
         self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo));
395 395
     }
396 396
     
397
-    public static function setSimulation(bool $simulate=true) : void
397
+    public static function setSimulation(bool $simulate = true) : void
398 398
     {
399 399
         self::$simulation = $simulate;
400 400
     }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      * @return string
446 446
      * @throws DOMException
447 447
      */
448
-    public static function buildErrorXML($code, string $message, string $title, array $customInfo=array()) : string
448
+    public static function buildErrorXML($code, string $message, string $title, array $customInfo = array()) : string
449 449
     {
450 450
         $xml = new DOMDocument('1.0', 'UTF-8');
451 451
         $xml->formatOutput = true;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $helper->addTextTag($root, 'title', $title);
460 460
         $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']);
461 461
         
462
-        foreach($customInfo as $name => $value) {
462
+        foreach ($customInfo as $name => $value) {
463 463
             $helper->addTextTag($root, $name, $value);
464 464
         }
465 465
 
Please login to merge, or discard this patch.
src/RequestHelper/Boundaries/Boundary.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
     protected RequestHelper_Boundaries $boundaries;
26 26
     protected string $transferEncoding = '';
27 27
 
28
-   /**
29
-    * @var array<string,string>
30
-    */
28
+    /**
29
+     * @var array<string,string>
30
+     */
31 31
     protected array $dispositionParams = array();
32 32
 
33 33
     public function __construct(RequestHelper_Boundaries $boundaries, string $content)
@@ -41,46 +41,46 @@  discard block
 block discarded – undo
41 41
         return strlen($this->content);
42 42
     }
43 43
     
44
-   /**
45
-    * Sets the name of the request parameter.
46
-    * 
47
-    * @param string $name
48
-    * @return RequestHelper_Boundaries_Boundary
49
-    */
44
+    /**
45
+     * Sets the name of the request parameter.
46
+     * 
47
+     * @param string $name
48
+     * @return RequestHelper_Boundaries_Boundary
49
+     */
50 50
     public function setName(string $name) : RequestHelper_Boundaries_Boundary
51 51
     {
52 52
         return $this->setDispositionParam('name', $name);
53 53
     }
54 54
     
55
-   /**
56
-    * Sets the filename to use for the content, if applicable.
57
-    *  
58
-    * @param string $fileName
59
-    * @return RequestHelper_Boundaries_Boundary
60
-    */
55
+    /**
56
+     * Sets the filename to use for the content, if applicable.
57
+     *  
58
+     * @param string $fileName
59
+     * @return RequestHelper_Boundaries_Boundary
60
+     */
61 61
     public function setFileName(string $fileName) : RequestHelper_Boundaries_Boundary
62 62
     {
63 63
         return $this->setDispositionParam('filename', $fileName);
64 64
     }
65 65
     
66
-   /**
67
-    * Sets the content type to use for the content.
68
-    * 
69
-    * @param string $contentType
70
-    * @return RequestHelper_Boundaries_Boundary
71
-    */
66
+    /**
67
+     * Sets the content type to use for the content.
68
+     * 
69
+     * @param string $contentType
70
+     * @return RequestHelper_Boundaries_Boundary
71
+     */
72 72
     public function setContentType(string $contentType) : RequestHelper_Boundaries_Boundary
73 73
     {
74 74
         $this->contentType = $contentType;
75 75
         return $this;
76 76
     }
77 77
     
78
-   /**
79
-    * Sets the encoding to specify for the content.
80
-    * 
81
-    * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII"
82
-    * @return RequestHelper_Boundaries_Boundary
83
-    */
78
+    /**
79
+     * Sets the encoding to specify for the content.
80
+     * 
81
+     * @param string $encoding An encoding string, e.g. "UTF-8", "ASCII"
82
+     * @return RequestHelper_Boundaries_Boundary
83
+     */
84 84
     public function setContentEncoding(string $encoding) : RequestHelper_Boundaries_Boundary
85 85
     {
86 86
         $this->contentEncoding = $encoding;
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
         return $this;
101 101
     }
102 102
     
103
-   /**
104
-    * Renders the mime boundary text.
105
-    * 
106
-    * @return string
107
-    */
103
+    /**
104
+     * Renders the mime boundary text.
105
+     * 
106
+     * @return string
107
+     */
108 108
     public function render() : string
109 109
     {
110 110
         $eol = $this->boundaries->getEOL();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
         $lines[] = '--'.$this->boundaries->getMimeBoundary();
114 114
         $lines[] = $this->renderContentDisposition();
115 115
         
116
-        if(!empty($this->contentType)) 
116
+        if (!empty($this->contentType)) 
117 117
         {
118 118
             $lines[] = $this->renderContentType();
119 119
         }
120 120
         
121
-        if(!empty($this->transferEncoding))
121
+        if (!empty($this->transferEncoding))
122 122
         {
123 123
             $lines[] = $this->renderTransferEncoding();
124 124
         }
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $result = 'Content-Disposition: form-data';
135 135
         
136
-        foreach($this->dispositionParams as $name => $value) 
136
+        foreach ($this->dispositionParams as $name => $value) 
137 137
         {
138
-            $result .= '; '.$name.'="' . $value . '"';
138
+            $result .= '; '.$name.'="'.$value.'"';
139 139
         }   
140 140
         
141 141
         return $result;
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
     
144 144
     protected function renderContentType() : string
145 145
     {
146
-        $result = 'Content-Type: ' . $this->contentType; 
146
+        $result = 'Content-Type: '.$this->contentType; 
147 147
         
148
-        if(!empty($this->contentEncoding)) 
148
+        if (!empty($this->contentEncoding)) 
149 149
         {
150
-            $result .= '; charset="' . $this->contentEncoding.'"';
150
+            $result .= '; charset="'.$this->contentEncoding.'"';
151 151
         }
152 152
         
153 153
         return $result;
@@ -155,6 +155,6 @@  discard block
 block discarded – undo
155 155
     
156 156
     protected function renderTransferEncoding() : string
157 157
     {
158
-        return 'Content-Transfer-Encoding: ' . $this->transferEncoding;
158
+        return 'Content-Transfer-Encoding: '.$this->transferEncoding;
159 159
     }
160 160
 }
Please login to merge, or discard this patch.