GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — 2.x-dev ( 100c60...613aa4 )
by Patrick D
05:21 queued 03:24
created
src/DOMList.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
   }
22 22
   
23 23
   // Provides read-only access to $length and $dom
24
-  public function __get ($prop) {
24
+  public function __get($prop) {
25 25
     if ($prop == 'length') {
26 26
       return $this->length;
27 27
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,11 +24,9 @@  discard block
 block discarded – undo
24 24
   public function __get ($prop) {
25 25
     if ($prop == 'length') {
26 26
       return $this->length;
27
-    }
28
-    else if ($prop == 'dom') {
27
+    } else if ($prop == 'dom') {
29 28
       return $this->dom;
30
-    }
31
-    else {
29
+    } else {
32 30
       return null;
33 31
     }
34 32
   }
@@ -56,8 +54,9 @@  discard block
 block discarded – undo
56 54
   public function item($index) {
57 55
     if (isset($this->array[$index])) {
58 56
       return $this->array[$index];
57
+    } else {
58
+      return FALSE;
59 59
     }
60
-    else return FALSE;
61 60
   }
62 61
   
63 62
   public function count() {
Please login to merge, or discard this patch.
src/DOMDoc.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         $prefix = $parts[0]; 
325 325
         if (isset($namespaces[$prefix])) {
326 326
           if (!strpos($root_match[0], "xmlns:$prefix")) {
327
-            $new_root .= " xmlns:$prefix='" . $namespaces[$prefix] . "'";             
327
+            $new_root .= " xmlns:$prefix='".$namespaces[$prefix]."'";             
328 328
           }
329 329
         }
330 330
       }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
     $dom = new DOMDoc($xml, $this->auto_ns);
335 335
     if (!$dom->documentElement) {
336
-      trigger_error('BetterDomDocument\DOMDoc Error: Invalid XML: ' . $xml);
336
+      trigger_error('BetterDomDocument\DOMDoc Error: Invalid XML: '.$xml);
337 337
     }
338 338
     $element = $dom->documentElement;
339 339
     
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
     $this->createContext($newnode, 'xml');
439 439
     $this->createContext($context, 'xpath');
440 440
     
441
-    if (!$context){
441
+    if (!$context) {
442 442
       return FALSE;
443 443
     }
444 444
     
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     
510 510
     if ($node) {
511 511
       if (is_array($node) || get_class($node) == 'BetterDOMDocument\DOMList') {
512
-        foreach($node as $item) {
512
+        foreach ($node as $item) {
513 513
           $this->remove($item);
514 514
         }
515 515
       }
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
       $xsl = '
582 582
         <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
583 583
           <xsl:template match="*">
584
-            <xsl:element name="' . $prefix . ':{local-name()}" namespace="' . $url . '">
584
+            <xsl:element name="' . $prefix.':{local-name()}" namespace="'.$url.'">
585 585
              <xsl:copy-of select="@*"/>
586 586
              <xsl:apply-templates/>
587 587
             </xsl:element>
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     }
594 594
     else {
595 595
       // @@TODO: Report the correct calling file and number
596
-      throw new \Exception("Changing the namespace of a " . get_class($node) . " is not supported");
596
+      throw new \Exception("Changing the namespace of a ".get_class($node)." is not supported");
597 597
     }
598 598
   }
599 599
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
       foreach ($this->getNamespaces() as $prefix => $url) {
669 669
         $namespaces = '';
670 670
         if ($prefix != 'xsl' && $prefix != 'xlink') {
671
-          $namespaces .= 'xmlns:' . $prefix . '="' . $url. '" ';
671
+          $namespaces .= 'xmlns:'.$prefix.'="'.$url.'" ';
672 672
         }
673 673
         $xslOptions = str_replace("||namespaces||", $namespaces, $xslOptions);
674 674
       }
@@ -707,8 +707,8 @@  discard block
 block discarded – undo
707 707
 
708 708
     // Copy namespace prefixes
709 709
     foreach ($this->ns as $prefix => $namespace) {
710
-      if (!empty($namespace) && !$context->hasAttribute('xmlns:' . $prefix)) {
711
-        $context->setAttribute('xmlns:' . $prefix, $namespace);
710
+      if (!empty($namespace) && !$context->hasAttribute('xmlns:'.$prefix)) {
711
+        $context->setAttribute('xmlns:'.$prefix, $namespace);
712 712
       }
713 713
     }
714 714
     
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
       // The types listed are html "void" elements. 
719 719
       // Find any of these elements that have no child nodes and are therefore candidates for self-closing, replace them with a self-closed version. 
720 720
       $pattern = '<(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)(\b[^<]*)><\/\1>';
721
-      return preg_replace('/' . $pattern . '/', '<$1$2/>', $output);
721
+      return preg_replace('/'.$pattern.'/', '<$1$2/>', $output);
722 722
     }
723 723
     else {
724 724
       return $this->saveXML($context, LIBXML_NOEMPTYTAG);
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
     // If it's an "XML" document, then get namespaces via xpath
807 807
     $xpath = new \DOMXPath($this);
808
-    foreach($xpath->query('namespace::*') as $namespace) {
808
+    foreach ($xpath->query('namespace::*') as $namespace) {
809 809
       if (!empty($namespace->prefix)) {
810 810
         if ($namespace->prefix != 'xml' && $namespace->nodeValue != 'http://www.w3.org/XML/1998/namespace') {
811 811
           $this->registerNamespace($namespace->prefix, $namespace->nodeValue);
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
             } 
844 844
           }
845 845
         }
846
-        else if (substr($attr->name,0,6) == 'xmlns:') {
847
-          $prefix = substr($attr->name,6);
846
+        else if (substr($attr->name, 0, 6) == 'xmlns:') {
847
+          $prefix = substr($attr->name, 6);
848 848
           $this->registerNamespace($prefix, $attr->value); 
849 849
         }
850 850
       }
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
       @$this->loadXML($xml, LIBXML_COMPACT);
902 902
     }
903 903
     else if (!$this->loadXML($xml, LIBXML_COMPACT)) {
904
-      trigger_error('BetterDOMDocument\DOMDoc: Could not load: ' . htmlspecialchars($xml), E_USER_WARNING);
904
+      trigger_error('BetterDOMDocument\DOMDoc: Could not load: '.htmlspecialchars($xml), E_USER_WARNING);
905 905
     }
906 906
   }
907 907
 }
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -41,23 +41,19 @@  discard block
 block discarded – undo
41 41
     if (is_object($xml)) {
42 42
       if (is_a($xml, 'DOMElement')) {
43 43
         $this->appendChild($this->importNode($xml, true));
44
-      }
45
-      elseif (is_a($xml, 'BetterDOMDocument\DOMDoc')) {
44
+      } elseif (is_a($xml, 'BetterDOMDocument\DOMDoc')) {
46 45
         if ($xml->documentElement) {
47 46
           $this->appendChild($this->importNode($xml->documentElement, true));
48 47
         }
49 48
         $this->ns = $xml->ns;
50
-      }
51
-      elseif (is_a($xml, 'DOMDocument')) {
49
+      } elseif (is_a($xml, 'DOMDocument')) {
52 50
         if ($xml->documentElement) {
53 51
           $this->appendChild($this->importNode($xml->documentElement, true));
54 52
         }
55
-      }
56
-      elseif (method_exists($xml, '__toString')) {
53
+      } elseif (method_exists($xml, '__toString')) {
57 54
         $this->loadFromString($xml->__toString());
58 55
       }
59
-    }
60
-    elseif (is_string($xml) && !empty($xml)) {
56
+    } elseif (is_string($xml) && !empty($xml)) {
61 57
       $this->loadFromString($xml);
62 58
     }
63 59
 
@@ -113,8 +109,7 @@  discard block
 block discarded – undo
113 109
   public function lookupURL($prefix) {
114 110
     if (isset($this->ns[$prefix])) {
115 111
       return $this->ns[$prefix];
116
-    }
117
-    else {
112
+    } else {
118 113
       return FALSE;
119 114
     }
120 115
   }
@@ -148,15 +143,13 @@  discard block
 block discarded – undo
148 143
 
149 144
     if ($context) {
150 145
       $result = $xob->query($xpath, $context);
151
-    }
152
-    else {
146
+    } else {
153 147
       $result = $xob->query($xpath);
154 148
     }
155 149
 
156 150
     if ($result) {
157 151
       return new DOMList($result, $this);
158
-    }
159
-    else {
152
+    } else {
160 153
       return FALSE;
161 154
     }
162 155
   }
@@ -180,8 +173,7 @@  discard block
 block discarded – undo
180 173
     
181 174
     if (empty($result) || !count($result)) {
182 175
       return FALSE;
183
-    }
184
-    else {
176
+    } else {
185 177
       return $result->item(0);
186 178
     }
187 179
   }
@@ -260,13 +252,11 @@  discard block
 block discarded – undo
260 252
       if ($context->hasChildNodes()) {
261 253
         if ($context->childNodes->length == 1 && $context->firstChild->nodeType == XML_TEXT_NODE) {
262 254
           $array['#text'] = $context->firstChild->nodeValue;
263
-        }
264
-        else {
255
+        } else {
265 256
           foreach ($context->childNodes as $childNode) {
266 257
             if ($childNode->nodeType == XML_ELEMENT_NODE) {
267 258
               $array[$childNode->nodeName][] = $this->getArray($raw, $childNode);
268
-            }
269
-            elseif ($childNode->nodeType == XML_CDATA_SECTION_NODE) {
259
+            } elseif ($childNode->nodeType == XML_CDATA_SECTION_NODE) {
270 260
               $array['#text'] = $childNode->textContent;
271 261
             }
272 262
           }
@@ -298,8 +288,7 @@  discard block
 block discarded – undo
298 288
     $matches = array();
299 289
     if (preg_match($pattern, $this->saveXML($context), $matches)) {
300 290
       return $matches[1];
301
-    }
302
-    else {
291
+    } else {
303 292
       return '';
304 293
     }
305 294
   }
@@ -445,8 +434,7 @@  discard block
 block discarded – undo
445 434
     if ($context->nextSibling) { 
446 435
       // $context has an immediate sibling : insert newnode before this one 
447 436
       return $context->parentNode->insertBefore($newnode, $context->nextSibling); 
448
-    }
449
-    else { 
437
+    } else { 
450 438
       return $context->parentNode->appendChild($newnode); 
451 439
     }
452 440
   }
@@ -512,11 +500,9 @@  discard block
 block discarded – undo
512 500
         foreach($node as $item) {
513 501
           $this->remove($item);
514 502
         }
515
-      }
516
-      else if (get_class($node) == 'DOMNodeList') {
503
+      } else if (get_class($node) == 'DOMNodeList') {
517 504
         $this->remove(new DOMList($node, $this));
518
-      }
519
-      else {
505
+      } else {
520 506
         $parent = $node->parentNode;
521 507
         $parent->removeChild($node);
522 508
       }
@@ -538,8 +524,7 @@  discard block
 block discarded – undo
538 524
   public function tranform($xsl, $context = NULL) {
539 525
     if (!$context) {
540 526
       $doc = $this;
541
-    }
542
-    else {
527
+    } else {
543 528
       if (is_string($context)) {
544 529
         $context = $this->xpathSingle($context);
545 530
       }
@@ -590,8 +575,7 @@  discard block
 block discarded – undo
590 575
 
591 576
       $transformed = $this->tranform($xsl, $node);
592 577
       return $this->replace($node, $transformed->documentElement);   
593
-    }
594
-    else {
578
+    } else {
595 579
       // @@TODO: Report the correct calling file and number
596 580
       throw new \Exception("Changing the namespace of a " . get_class($node) . " is not supported");
597 581
     }
@@ -676,14 +660,12 @@  discard block
 block discarded – undo
676 660
       // Add in xlink options
677 661
       if ($options['xlink'] === TRUE) {
678 662
         $options['xlink'] = "@xlink:type = 'simple'";
679
-      }
680
-      else if (empty($options['xlink'])) {
663
+      } else if (empty($options['xlink'])) {
681 664
         $options['xlink'] = "false()";
682 665
       }
683 666
       $xslOptions = str_replace("||xlink||", $options['xlink'], $xslOptions);
684 667
       $transformed = $this->tranform($xslOptions, $context);
685
-    }
686
-    else {
668
+    } else {
687 669
       $transformed = $this->tranform($xslSimple, $context);
688 670
     }
689 671
     
@@ -719,8 +701,7 @@  discard block
 block discarded – undo
719 701
       // Find any of these elements that have no child nodes and are therefore candidates for self-closing, replace them with a self-closed version. 
720 702
       $pattern = '<(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)(\b[^<]*)><\/\1>';
721 703
       return preg_replace('/' . $pattern . '/', '<$1$2/>', $output);
722
-    }
723
-    else {
704
+    } else {
724 705
       return $this->saveXML($context, LIBXML_NOEMPTYTAG);
725 706
     }
726 707
   }
@@ -749,8 +730,7 @@  discard block
 block discarded – undo
749 730
     // Check up error-checking
750 731
     if ($error_checking == FALSE) {
751 732
       $this->error_checking = 'none';
752
-    }
753
-    else {
733
+    } else {
754 734
       $this->error_checking = $error_checking;
755 735
     }
756 736
     if ($this->error_checking != 'strict') {
@@ -810,8 +790,7 @@  discard block
 block discarded – undo
810 790
         if ($namespace->prefix != 'xml' && $namespace->nodeValue != 'http://www.w3.org/XML/1998/namespace') {
811 791
           $this->registerNamespace($namespace->prefix, $namespace->nodeValue);
812 792
         }
813
-      }
814
-      else {
793
+      } else {
815 794
         $this->default_ns = $namespace->nodeValue;
816 795
         if (is_string($auto_register_namespaces)) {
817 796
           $this->registerNamespace($auto_register_namespaces, $namespace->nodeValue);
@@ -842,8 +821,7 @@  discard block
 block discarded – undo
842 821
               $this->registerNamespace($tagname, $attr->value);
843 822
             } 
844 823
           }
845
-        }
846
-        else if (substr($attr->name,0,6) == 'xmlns:') {
824
+        } else if (substr($attr->name,0,6) == 'xmlns:') {
847 825
           $prefix = substr($attr->name,6);
848 826
           $this->registerNamespace($prefix, $attr->value); 
849 827
         }
@@ -882,12 +860,10 @@  discard block
 block discarded – undo
882 860
         }
883 861
         $context = $this->importNode($context->documentElement, TRUE);
884 862
         return;
885
-      }
886
-      else if (is_a($context, 'DOMDocument')) {
863
+      } else if (is_a($context, 'DOMDocument')) {
887 864
         $context = $this->importNode($context->documentElement, TRUE);
888 865
         return;
889
-      }
890
-      else {
866
+      } else {
891 867
         $context = $this->importNode($context, TRUE);
892 868
         return;
893 869
       }
@@ -899,8 +875,7 @@  discard block
 block discarded – undo
899 875
   protected function loadFromString($xml) {
900 876
     if ($this->error_checking == 'none') {
901 877
       @$this->loadXML($xml, LIBXML_COMPACT);
902
-    }
903
-    else if (!$this->loadXML($xml, LIBXML_COMPACT)) {
878
+    } else if (!$this->loadXML($xml, LIBXML_COMPACT)) {
904 879
       trigger_error('BetterDOMDocument\DOMDoc: Could not load: ' . htmlspecialchars($xml), E_USER_WARNING);
905 880
     }
906 881
   }
Please login to merge, or discard this patch.
Doc Comments   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
   /**
471 471
    * Given a pair of nodes, replace the first with the second
472 472
    * 
473
-   * @param mixed $node
473
+   * @param \DOMElement $node
474 474
    *  Node to be replaced. Can either be an xpath string or a DOMDocument (or even a DOMNode).
475 475
    * 
476
-   * @param mixed $replace
476
+   * @param \DOMElement $replace
477 477
    *  Replace $node with $replace. Replace can be an XML string, or a DOMNode
478 478
    * 
479 479
    * @return mixed
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
    *   $context can either be an xpath string, or a DOMElement. Ommiting it
534 534
    *   results in transforming the entire document
535 535
    * 
536
-   * @return a new DOMDoc
536
+   * @return DOMDoc new DOMDoc
537 537
    */
538 538
   public function tranform($xsl, $context = NULL) {
539 539
     if (!$context) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
    *     it will transform all elements with xlink:type = simple into a <a href> element. 
616 616
    *     Alternatively you may specify your own xpath for selecting which elements get transformed
617 617
    *     into <a href> tags. 
618
-   * @return HTML string
618
+   * @return string string
619 619
    */  
620 620
   public function asHTML($context = NULL, $options = array()) {
621 621
     $xslSimple = '
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
    *   $context can either be an xpath string, or a DOMElement. Ommiting it
698 698
    *   results in outputting the entire document
699 699
    * 
700
-   * @return XML string
700
+   * @return string string
701 701
    */  
702 702
   public function out($context = NULL) {
703 703
     $this->createContext($context, 'xpath');
@@ -745,6 +745,9 @@  discard block
 block discarded – undo
745 745
     );
746 746
   }
747 747
 
748
+  /**
749
+   * @param string|boolean $error_checking
750
+   */
748 751
   public function setErrorChecking($error_checking) {
749 752
     // Check up error-checking
750 753
     if ($error_checking == FALSE) {
@@ -774,6 +777,9 @@  discard block
 block discarded – undo
774 777
     return boolval($success);
775 778
   }
776 779
 
780
+  /**
781
+   * @param integer $options
782
+   */
777 783
   public function loadXML($source, $options = NULL) {
778 784
     $success = parent::loadXML($source, $options);
779 785
     $this->AutoRegisterNamespace(TRUE);
@@ -800,6 +806,9 @@  discard block
 block discarded – undo
800 806
     unset($this->ns[$prefix]);
801 807
   }
802 808
 
809
+  /**
810
+   * @param boolean|string $auto_register_namespaces
811
+   */
803 812
   protected function AutoRegisterNamespace($auto_register_namespaces) {
804 813
     $this->auto_ns = TRUE;
805 814
 
Please login to merge, or discard this patch.