Passed
Push — master ( 123cfe...693dda )
by Sebastian
02:32
created
src/XMLHelper.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function addAttribute($parent, string $name, $value)
110 110
     {
111
-        if(!$parent instanceof \DOMNode) {
111
+        if (!$parent instanceof \DOMNode) {
112 112
             throw new XMLHelper_Exception(
113 113
                 'The specified parent node is not a node instance.',
114 114
                 sprintf('Tried adding attribute [%s].', $name),
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         if (!empty($text)) {
232 232
             $fragment = $this->dom->createDocumentFragment();
233
-            if(!@$fragment->appendXML($text)) {
233
+            if (!@$fragment->appendXML($text)) {
234 234
                 throw new XMLHelper_Exception(
235 235
                     'Cannot append XML fragment',
236 236
                     sprintf(
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param array $attributes
273 273
      * @return \DOMNode
274 274
      */
275
-    public function createRoot($name, $attributes=array())
275
+    public function createRoot($name, $attributes = array())
276 276
     {
277 277
         $root = $this->dom->appendChild($this->dom->createElement($name));
278 278
         $this->addAttributes($root, $attributes);
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
         $string = str_replace('<', 'LT_ESCAPE', $string);
294 294
         $string = str_replace('>', 'GT_ESCAPE', $string);
295 295
 
296
-        $string = str_replace(' ',' ',  $string);
297
-        $string = str_replace('&','&',  $string);
296
+        $string = str_replace(' ', ' ', $string);
297
+        $string = str_replace('&', '&', $string);
298 298
 
299 299
         return $string;
300 300
     }
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public static function downloadXML($xml, $filename = 'download.xml')
311 311
     {
312
-        if(!headers_sent() && !self::$simulation) {
313
-            header('Content-Disposition: attachment; filename="' . $filename . '"');
312
+        if (!headers_sent() && !self::$simulation) {
313
+            header('Content-Disposition: attachment; filename="'.$filename.'"');
314 314
         }
315 315
         
316 316
         echo $xml;
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
      */
326 326
     public static function displayXML($xml)
327 327
     {
328
-        if(!headers_sent() && !self::$simulation) {
328
+        if (!headers_sent() && !self::$simulation) {
329 329
             header('Content-Type:text/xml; charset=utf-8');
330 330
         }
331 331
         
332
-        if(self::$simulation) {
332
+        if (self::$simulation) {
333 333
             $xml = '<pre>'.htmlspecialchars($xml).'</pre>';
334 334
         }
335 335
         
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
      * @param string[] $customInfo Associative array with name => value pairs for custom tags to add to the output xml
348 348
      * @see buildErrorXML()
349 349
      */
350
-    public static function displayErrorXML($code, $message, $title, $customInfo=array())
350
+    public static function displayErrorXML($code, $message, $title, $customInfo = array())
351 351
     {
352
-        if(!headers_sent() && !self::$simulation) {
353
-            header('HTTP/1.1 400 Bad Request: ' . $title, true, 400);
352
+        if (!headers_sent() && !self::$simulation) {
353
+            header('HTTP/1.1 400 Bad Request: '.$title, true, 400);
354 354
         }
355 355
 
356 356
         self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo));
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     
359 359
     protected static $simulation = false;
360 360
     
361
-    public static function setSimulation($simulate=true)
361
+    public static function setSimulation($simulate = true)
362 362
     {
363 363
         self::$simulation = $simulate;
364 364
     }
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
      * @param string $title
407 407
      * @return string
408 408
      */
409
-    public static function buildErrorXML($code, $message, $title, $customInfo=array())
409
+    public static function buildErrorXML($code, $message, $title, $customInfo = array())
410 410
     {
411 411
         $xml = new \DOMDocument('1.0', 'UTF-8');
412 412
         $xml->formatOutput = true;
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         $helper->addTextTag($root, 'title', $title);
421 421
         $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']);
422 422
         
423
-        foreach($customInfo as $name => $value) {
423
+        foreach ($customInfo as $name => $value) {
424 424
             $helper->addTextTag($root, $name, $value);
425 425
         }
426 426
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     */
466 466
     public static function string2xml(string $string) : string
467 467
     {
468
-        if(stristr($string, '<body')) 
468
+        if (stristr($string, '<body')) 
469 469
         {
470 470
             throw new XMLHelper_Exception(
471 471
                 'Cannot convert string with existing body element',
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
         
496 496
         // capture all elements except the body tag itself
497 497
         $xml = '';
498
-        foreach($root->childNodes as $child) {
498
+        foreach ($root->childNodes as $child) {
499 499
             $xml .= $dom->saveXML($child);
500 500
         }
501 501
         
Please login to merge, or discard this patch.
src/Transliteration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * The converted string will be all lowercase.
61 61
      * @return Transliteration
62 62
      */
63
-    public function setLowercase(bool $lowercase=true) : Transliteration
63
+    public function setLowercase(bool $lowercase = true) : Transliteration
64 64
     {
65 65
         $this->setOption('lowercase', $lowercase);
66 66
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
         $result = implode('', $keep);
99 99
 
100
-        while (strstr($result, $space . $space)) {
101
-            $result = str_replace($space . $space, $space, $result);
100
+        while (strstr($result, $space.$space)) {
101
+            $result = str_replace($space.$space, $space, $result);
102 102
         }
103 103
 
104 104
         $result = trim($result, $space);
Please login to merge, or discard this patch.