| @@ -61,8 +61,7 @@ discard block | ||
| 61 | 61 |      if ($xml && is_string($xml)) { | 
| 62 | 62 |        if ($this->error_checking == 'none') { | 
| 63 | 63 | @$this->loadXML($xml, LIBXML_COMPACT); | 
| 64 | - } | |
| 65 | -      else { | |
| 64 | +      } else { | |
| 66 | 65 |          if (!$this->loadXML($xml, LIBXML_COMPACT)) { | 
| 67 | 66 |            trigger_error('BetterDOMDocument\DOMDoc: Could not load: ' . htmlspecialchars($xml), E_USER_WARNING); | 
| 68 | 67 | } | 
| @@ -118,8 +117,7 @@ discard block | ||
| 118 | 117 |    public function lookupURL($prefix) { | 
| 119 | 118 |      if (isset($this->ns[$prefix])) { | 
| 120 | 119 | return $this->ns[$prefix]; | 
| 121 | - } | |
| 122 | -    else { | |
| 120 | +    } else { | |
| 123 | 121 | return FALSE; | 
| 124 | 122 | } | 
| 125 | 123 | } | 
| @@ -153,15 +151,13 @@ discard block | ||
| 153 | 151 | |
| 154 | 152 |      if ($context) { | 
| 155 | 153 | $result = $xob->query($xpath, $context); | 
| 156 | - } | |
| 157 | -    else { | |
| 154 | +    } else { | |
| 158 | 155 | $result = $xob->query($xpath); | 
| 159 | 156 | } | 
| 160 | 157 | |
| 161 | 158 |      if ($result) { | 
| 162 | 159 | return new DOMList($result, $this); | 
| 163 | - } | |
| 164 | -    else { | |
| 160 | +    } else { | |
| 165 | 161 | return FALSE; | 
| 166 | 162 | } | 
| 167 | 163 | } | 
| @@ -185,8 +181,7 @@ discard block | ||
| 185 | 181 | |
| 186 | 182 |      if (empty($result) || !count($result)) { | 
| 187 | 183 | return FALSE; | 
| 188 | - } | |
| 189 | -    else { | |
| 184 | +    } else { | |
| 190 | 185 | return $result->item(0); | 
| 191 | 186 | } | 
| 192 | 187 | } | 
| @@ -265,13 +260,11 @@ discard block | ||
| 265 | 260 |        if ($context->hasChildNodes()) { | 
| 266 | 261 |          if ($context->childNodes->length == 1 && $context->firstChild->nodeType == XML_TEXT_NODE) { | 
| 267 | 262 | $array['#text'] = $context->firstChild->nodeValue; | 
| 268 | - } | |
| 269 | -        else { | |
| 263 | +        } else { | |
| 270 | 264 |            foreach ($context->childNodes as $childNode) { | 
| 271 | 265 |              if ($childNode->nodeType == XML_ELEMENT_NODE) { | 
| 272 | 266 | $array[$childNode->nodeName][] = $this->getArray($raw, $childNode); | 
| 273 | - } | |
| 274 | -            elseif ($childNode->nodeType == XML_CDATA_SECTION_NODE) { | |
| 267 | +            } elseif ($childNode->nodeType == XML_CDATA_SECTION_NODE) { | |
| 275 | 268 | $array['#text'] = $childNode->textContent; | 
| 276 | 269 | } | 
| 277 | 270 | } | 
| @@ -303,8 +296,7 @@ discard block | ||
| 303 | 296 | $matches = array(); | 
| 304 | 297 |      if (preg_match($pattern, $this->saveXML($context), $matches)) { | 
| 305 | 298 | return $matches[1]; | 
| 306 | - } | |
| 307 | -    else { | |
| 299 | +    } else { | |
| 308 | 300 | return ''; | 
| 309 | 301 | } | 
| 310 | 302 | } | 
| @@ -374,8 +366,7 @@ discard block | ||
| 374 | 366 | |
| 375 | 367 |      if ($newnode->ownerDocument === $this) { | 
| 376 | 368 | $appendnode = $newnode; | 
| 377 | - } | |
| 378 | -    else { | |
| 369 | +    } else { | |
| 379 | 370 | $appendnode = $this->importNode($newnode, true); | 
| 380 | 371 | } | 
| 381 | 372 | |
| @@ -457,13 +448,11 @@ discard block | ||
| 457 | 448 |      if ($context->nextSibling) {  | 
| 458 | 449 | // $context has an immediate sibling : insert newnode before this one | 
| 459 | 450 | return $context->parentNode->insertBefore($newnode, $context->nextSibling); | 
| 460 | - } | |
| 461 | -    else {  | |
| 451 | +    } else {  | |
| 462 | 452 | // $context has no sibling next to it : insert newnode as last child of it's parent | 
| 463 | 453 |        if ($newnode->ownerDocument === $this) { | 
| 464 | 454 | $appendnode = $newnode; | 
| 465 | - } | |
| 466 | -      else { | |
| 455 | +      } else { | |
| 467 | 456 | $appendnode = $this->importNode($newnode, true); | 
| 468 | 457 | } | 
| 469 | 458 | return $context->parentNode->appendChild($appendnode); | 
| @@ -531,11 +520,9 @@ discard block | ||
| 531 | 520 |          foreach($node as $item) { | 
| 532 | 521 | $this->remove($item); | 
| 533 | 522 | } | 
| 534 | - } | |
| 535 | -      else if (get_class($node) == 'DOMNodeList') { | |
| 523 | +      } else if (get_class($node) == 'DOMNodeList') { | |
| 536 | 524 | $this->remove(new DOMList($node, $this)); | 
| 537 | - } | |
| 538 | -      else { | |
| 525 | +      } else { | |
| 539 | 526 | $parent = $node->parentNode; | 
| 540 | 527 | $parent->removeChild($node); | 
| 541 | 528 | } | 
| @@ -557,8 +544,7 @@ discard block | ||
| 557 | 544 |    public function tranform($xsl, $context = NULL) { | 
| 558 | 545 |      if (!$context) { | 
| 559 | 546 | $doc = $this; | 
| 560 | - } | |
| 561 | -    else { | |
| 547 | +    } else { | |
| 562 | 548 |        if (is_string($context)) { | 
| 563 | 549 | $context = $this->xpathSingle($context); | 
| 564 | 550 | } | 
| @@ -611,8 +597,7 @@ discard block | ||
| 611 | 597 | |
| 612 | 598 | $transformed = $this->tranform($xsl, $node); | 
| 613 | 599 | return $this->replace($node, $transformed->documentElement); | 
| 614 | - } | |
| 615 | -    else { | |
| 600 | +    } else { | |
| 616 | 601 | // @@TODO: Report the correct calling file and number | 
| 617 | 602 |        throw new Exception("Changing the namespace of a " . get_class($node) . " is not supported"); | 
| 618 | 603 | } | 
| @@ -697,14 +682,12 @@ discard block | ||
| 697 | 682 | // Add in xlink options | 
| 698 | 683 |        if ($options['xlink'] === TRUE) { | 
| 699 | 684 | $options['xlink'] = "@xlink:type = 'simple'"; | 
| 700 | - } | |
| 701 | -      else if (empty($options['xlink'])) { | |
| 685 | +      } else if (empty($options['xlink'])) { | |
| 702 | 686 | $options['xlink'] = "false()"; | 
| 703 | 687 | } | 
| 704 | 688 |        $xslOptions = str_replace("||xlink||", $options['xlink'], $xslOptions); | 
| 705 | 689 | $transformed = $this->tranform($xslOptions, $context); | 
| 706 | - } | |
| 707 | -    else { | |
| 690 | +    } else { | |
| 708 | 691 | $transformed = $this->tranform($xslSimple, $context); | 
| 709 | 692 | } | 
| 710 | 693 | |
| @@ -740,8 +723,7 @@ discard block | ||
| 740 | 723 | // Find any of these elements that have no child nodes and are therefore candidates for self-closing, replace them with a self-closed version. | 
| 741 | 724 | $pattern = '<(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)(\b[^<]*)><\/\1>'; | 
| 742 | 725 |        return preg_replace('/' . $pattern . '/', '<$1$2/>', $output); | 
| 743 | - } | |
| 744 | -    else { | |
| 726 | +    } else { | |
| 745 | 727 | return $this->saveXML($context, LIBXML_NOEMPTYTAG); | 
| 746 | 728 | } | 
| 747 | 729 | } | 
| @@ -757,8 +739,7 @@ discard block | ||
| 757 | 739 | // Check up error-checking | 
| 758 | 740 |      if ($error_checking == FALSE) { | 
| 759 | 741 | $this->error_checking = 'none'; | 
| 760 | - } | |
| 761 | -    else { | |
| 742 | +    } else { | |
| 762 | 743 | $this->error_checking = $error_checking; | 
| 763 | 744 | } | 
| 764 | 745 |      if ($this->error_checking != 'strict') { | 
| @@ -785,8 +766,7 @@ discard block | ||
| 785 | 766 |          if ($namespace->prefix != 'xml' && $namespace->nodeValue != 'http://www.w3.org/XML/1998/namespace') { | 
| 786 | 767 | $this->registerNamespace($namespace->prefix, $namespace->nodeValue); | 
| 787 | 768 | } | 
| 788 | - } | |
| 789 | -      else { | |
| 769 | +      } else { | |
| 790 | 770 | $this->default_ns = $namespace->nodeValue; | 
| 791 | 771 |          if (is_string($auto_register_namespaces)) { | 
| 792 | 772 | $this->registerNamespace($auto_register_namespaces, $namespace->nodeValue); | 
| @@ -817,8 +797,7 @@ discard block | ||
| 817 | 797 | $this->registerNamespace($tagname, $attr->value); | 
| 818 | 798 | } | 
| 819 | 799 | } | 
| 820 | - } | |
| 821 | -        else if (substr($attr->name,0,6) == 'xmlns:') { | |
| 800 | +        } else if (substr($attr->name,0,6) == 'xmlns:') { | |
| 822 | 801 | $prefix = substr($attr->name,6); | 
| 823 | 802 | $this->registerNamespace($prefix, $attr->value); | 
| 824 | 803 | } |