Passed
Push — master ( 16baae...6b22f3 )
by Sebastian
02:40
created
src/XMLHelper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function addAttribute($parent, string $name, $value)
107 107
     {
108
-        if(!$parent instanceof \DOMNode) {
108
+        if (!$parent instanceof \DOMNode) {
109 109
             throw new XMLHelper_Exception(
110 110
                 'The specified parent node is not a node instance.',
111 111
                 sprintf('Tried adding attribute [%s].', $name),
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         if (!empty($text)) {
229 229
             $fragment = $this->dom->createDocumentFragment();
230
-            if(!@$fragment->appendXML($text)) {
230
+            if (!@$fragment->appendXML($text)) {
231 231
                 throw new XMLHelper_Exception(
232 232
                     'Cannot append XML fragment',
233 233
                     sprintf(
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      * @param array $attributes
270 270
      * @return \DOMNode
271 271
      */
272
-    public function createRoot($name, $attributes=array())
272
+    public function createRoot($name, $attributes = array())
273 273
     {
274 274
         $root = $this->dom->appendChild($this->dom->createElement($name));
275 275
         $this->addAttributes($root, $attributes);
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
         $string = str_replace('<', 'LT_ESCAPE', $string);
291 291
         $string = str_replace('>', 'GT_ESCAPE', $string);
292 292
 
293
-        $string = str_replace(' ',' ',  $string);
294
-        $string = str_replace('&','&',  $string);
293
+        $string = str_replace(' ', ' ', $string);
294
+        $string = str_replace('&', '&', $string);
295 295
 
296 296
         return $string;
297 297
     }
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
      */
307 307
     public static function downloadXML($xml, $filename = 'download.xml')
308 308
     {
309
-        if(!headers_sent() && !self::$simulation) {
310
-            header('Content-Disposition: attachment; filename="' . $filename . '"');
309
+        if (!headers_sent() && !self::$simulation) {
310
+            header('Content-Disposition: attachment; filename="'.$filename.'"');
311 311
         }
312 312
         
313 313
         echo $xml;
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public static function displayXML($xml)
324 324
     {
325
-        if(!headers_sent() && !self::$simulation) {
325
+        if (!headers_sent() && !self::$simulation) {
326 326
             header('Content-Type:text/xml; charset=utf-8');
327 327
         }
328 328
         
329
-        if(self::$simulation) {
329
+        if (self::$simulation) {
330 330
             $xml = '<pre>'.htmlspecialchars($xml).'</pre>';
331 331
         }
332 332
         
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
      * @param string[] $customInfo Associative array with name => value pairs for custom tags to add to the output xml
345 345
      * @see buildErrorXML()
346 346
      */
347
-    public static function displayErrorXML($code, $message, $title, $customInfo=array())
347
+    public static function displayErrorXML($code, $message, $title, $customInfo = array())
348 348
     {
349
-        if(!headers_sent() && !self::$simulation) {
350
-            header('HTTP/1.1 400 Bad Request: ' . $title, true, 400);
349
+        if (!headers_sent() && !self::$simulation) {
350
+            header('HTTP/1.1 400 Bad Request: '.$title, true, 400);
351 351
         }
352 352
 
353 353
         self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo));
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     
356 356
     protected static $simulation = false;
357 357
     
358
-    public static function setSimulation($simulate=true)
358
+    public static function setSimulation($simulate = true)
359 359
     {
360 360
         self::$simulation = $simulate;
361 361
     }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * @param string $title
404 404
      * @return string
405 405
      */
406
-    public static function buildErrorXML($code, $message, $title, $customInfo=array())
406
+    public static function buildErrorXML($code, $message, $title, $customInfo = array())
407 407
     {
408 408
         $xml = new \DOMDocument('1.0', 'UTF-8');
409 409
         $xml->formatOutput = true;
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         $helper->addTextTag($root, 'title', $title);
418 418
         $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']);
419 419
         
420
-        foreach($customInfo as $name => $value) {
420
+        foreach ($customInfo as $name => $value) {
421 421
             $helper->addTextTag($root, $name, $value);
422 422
         }
423 423
 
Please login to merge, or discard this patch.
docs/libxml/generate-errorcodes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     $lines = explode("\n", $list);
23 23
     $reverseArray = array();
24 24
     
25
-    foreach($lines as $line)
25
+    foreach ($lines as $line)
26 26
     {
27 27
         $parts = explode('=', $line);
28 28
         $name = trim(str_replace('XML_ERR_', '', $parts[0]));
Please login to merge, or discard this patch.