| @@ -485,7 +485,7 @@ | ||
| 485 | 485 | */ | 
| 486 | 486 | public static function isA($name, $mask) | 
| 487 | 487 |      { | 
| 488 | -        if (! static::isElement($name)) { | |
| 488 | +        if (!static::isElement($name)) { | |
| 489 | 489 | return false; | 
| 490 | 490 | } | 
| 491 | 491 | |
| @@ -47,7 +47,7 @@ | ||
| 47 | 47 | */ | 
| 48 | 48 | public static function lookupDecimal($int) | 
| 49 | 49 |      { | 
| 50 | - $entity = '&#' . $int . ';'; | |
| 50 | + $entity = '&#'.$int.';'; | |
| 51 | 51 | // UNTESTED: This may fail on some planes. Couldn't find full documentation | 
| 52 | 52 | // on the value of the mask array. | 
| 53 | 53 | return mb_decode_numericentity($entity, static::$numeric_mask, 'utf-8'); | 
| @@ -188,7 +188,7 @@ | ||
| 188 | 188 | */ | 
| 189 | 189 | public function next() | 
| 190 | 190 |      { | 
| 191 | - $this->char ++; | |
| 191 | + $this->char++; | |
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | 194 | /** | 
| @@ -238,7 +238,7 @@ discard block | ||
| 238 | 238 | return $this->text($tok); | 
| 239 | 239 | } | 
| 240 | 240 | |
| 241 | - $sequence = '</' . $this->untilTag . '>'; | |
| 241 | + $sequence = '</'.$this->untilTag.'>'; | |
| 242 | 242 | $txt = $this->readUntilSequence($sequence); | 
| 243 | 243 | $this->events->text($txt); | 
| 244 | 244 | $this->setTextMode(0); | 
| @@ -259,11 +259,11 @@ discard block | ||
| 259 | 259 | return $this->text($tok); | 
| 260 | 260 | } | 
| 261 | 261 | |
| 262 | - $sequence = '</' . $this->untilTag; | |
| 262 | + $sequence = '</'.$this->untilTag; | |
| 263 | 263 | $txt = ''; | 
| 264 | 264 | |
| 265 | 265 | $caseSensitive = !Elements::isHtml5Element($this->untilTag); | 
| 266 | -        while ($tok !== false && ! ($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) { | |
| 266 | +        while ($tok !== false && !($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) { | |
| 267 | 267 |              if ($tok == '&') { | 
| 268 | 268 | $txt .= $this->decodeCharacterReference(); | 
| 269 | 269 | $tok = $this->scanner->current(); | 
| @@ -369,7 +369,7 @@ discard block | ||
| 369 | 369 | // > -> parse error | 
| 370 | 370 | // EOF -> parse error | 
| 371 | 371 | // -> parse error | 
| 372 | -        if (! ctype_alpha($tok)) { | |
| 372 | +        if (!ctype_alpha($tok)) { | |
| 373 | 373 |              $this->parseError("Expected tag name, got '%s'", $tok); | 
| 374 | 374 |              if ($tok == "\0" || $tok === false) { | 
| 375 | 375 | return false; | 
| @@ -378,7 +378,7 @@ discard block | ||
| 378 | 378 | } | 
| 379 | 379 | |
| 380 | 380 |          $name = $this->scanner->charsUntil("\n\f \t>"); | 
| 381 | - $name = $this->mode === self::CONFORMANT_XML ? $name: strtolower($name); | |
| 381 | + $name = $this->mode === self::CONFORMANT_XML ? $name : strtolower($name); | |
| 382 | 382 | // Trash whitespace. | 
| 383 | 383 | $this->scanner->whitespace(); | 
| 384 | 384 | |
| @@ -401,7 +401,7 @@ discard block | ||
| 401 | 401 | protected function tagName() | 
| 402 | 402 |      { | 
| 403 | 403 | $tok = $this->scanner->current(); | 
| 404 | -        if (! ctype_alpha($tok)) { | |
| 404 | +        if (!ctype_alpha($tok)) { | |
| 405 | 405 | return false; | 
| 406 | 406 | } | 
| 407 | 407 | |
| @@ -417,7 +417,7 @@ discard block | ||
| 417 | 417 |              do { | 
| 418 | 418 | $this->scanner->whitespace(); | 
| 419 | 419 | $this->attribute($attributes); | 
| 420 | - } while (! $this->isTagEnd($selfClose)); | |
| 420 | + } while (!$this->isTagEnd($selfClose)); | |
| 421 | 421 |          } catch (ParseError $e) { | 
| 422 | 422 | $selfClose = false; | 
| 423 | 423 | } | 
| @@ -584,7 +584,7 @@ discard block | ||
| 584 | 584 | */ | 
| 585 | 585 | protected function quotedAttributeValue($quote) | 
| 586 | 586 |      { | 
| 587 | - $stoplist = "\f" . $quote; | |
| 587 | + $stoplist = "\f".$quote; | |
| 588 | 588 | $val = ''; | 
| 589 | 589 | |
| 590 | 590 |          while (true) { | 
| @@ -686,7 +686,7 @@ discard block | ||
| 686 | 686 |          if ($tok == "\0") { | 
| 687 | 687 | $tok = UTF8Utils::FFFD; | 
| 688 | 688 | } | 
| 689 | -        while (! $this->isCommentEnd()) { | |
| 689 | +        while (!$this->isCommentEnd()) { | |
| 690 | 690 | $comment .= $tok; | 
| 691 | 691 | $tok = $this->scanner->next(); | 
| 692 | 692 | } | 
| @@ -746,7 +746,7 @@ discard block | ||
| 746 | 746 |          $chars = $this->scanner->charsWhile("DOCTYPEdoctype"); | 
| 747 | 747 |          if (strcasecmp($chars, 'DOCTYPE')) { | 
| 748 | 748 |              $this->parseError('Expected DOCTYPE, got %s', $chars); | 
| 749 | -            return $this->bogusComment('<!' . $chars); | |
| 749 | +            return $this->bogusComment('<!'.$chars); | |
| 750 | 750 | } | 
| 751 | 751 | |
| 752 | 752 | $this->scanner->whitespace(); | 
| @@ -853,7 +853,7 @@ discard block | ||
| 853 | 853 | $tok = $this->scanner->current(); | 
| 854 | 854 |          if ($tok == '"' || $tok == "'") { | 
| 855 | 855 | $this->scanner->next(); | 
| 856 | - $ret = $this->scanner->charsUntil($tok . $stopchars); | |
| 856 | + $ret = $this->scanner->charsUntil($tok.$stopchars); | |
| 857 | 857 |              if ($this->scanner->current() == $tok) { | 
| 858 | 858 | $this->scanner->next(); | 
| 859 | 859 |              } else { | 
| @@ -881,19 +881,19 @@ discard block | ||
| 881 | 881 |          $chars = $this->scanner->charsWhile('CDAT'); | 
| 882 | 882 |          if ($chars != 'CDATA' || $this->scanner->current() != '[') { | 
| 883 | 883 |              $this->parseError('Expected [CDATA[, got %s', $chars); | 
| 884 | -            return $this->bogusComment('<![' . $chars); | |
| 884 | +            return $this->bogusComment('<!['.$chars); | |
| 885 | 885 | } | 
| 886 | 886 | |
| 887 | 887 | $tok = $this->scanner->next(); | 
| 888 | 888 |          do { | 
| 889 | 889 |              if ($tok === false) { | 
| 890 | 890 |                  $this->parseError('Unexpected EOF inside CDATA.'); | 
| 891 | -                $this->bogusComment('<![CDATA[' . $cdata); | |
| 891 | +                $this->bogusComment('<![CDATA['.$cdata); | |
| 892 | 892 | return true; | 
| 893 | 893 | } | 
| 894 | 894 | $cdata .= $tok; | 
| 895 | 895 | $tok = $this->scanner->next(); | 
| 896 | -        } while (! $this->scanner->sequenceMatches(']]>')); | |
| 896 | +        } while (!$this->scanner->sequenceMatches(']]>')); | |
| 897 | 897 | |
| 898 | 898 | // Consume ]]> | 
| 899 | 899 | $this->scanner->consume(3); | 
| @@ -928,13 +928,13 @@ discard block | ||
| 928 | 928 | // If not a PI, send to bogusComment. | 
| 929 | 929 |          if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) { | 
| 930 | 930 |              $this->parseError("Expected processing instruction name, got $tok"); | 
| 931 | -            $this->bogusComment('<?' . $tok . $procName); | |
| 931 | +            $this->bogusComment('<?'.$tok.$procName); | |
| 932 | 932 | return true; | 
| 933 | 933 | } | 
| 934 | 934 | |
| 935 | 935 | $data = ''; | 
| 936 | 936 | // As long as it's not the case that the next two chars are ? and >. | 
| 937 | -        while (! ($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { | |
| 937 | +        while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { | |
| 938 | 938 | $data .= $this->scanner->current(); | 
| 939 | 939 | |
| 940 | 940 | $tok = $this->scanner->next(); | 
| @@ -1005,7 +1005,7 @@ discard block | ||
| 1005 | 1005 | */ | 
| 1006 | 1006 | protected function sequenceMatches($sequence, $caseSensitive = true) | 
| 1007 | 1007 |      { | 
| 1008 | - @trigger_error(__METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED); | |
| 1008 | + @trigger_error(__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED); | |
| 1009 | 1009 | |
| 1010 | 1010 | return $this->scanner->sequenceMatches($sequence, $caseSensitive); | 
| 1011 | 1011 | } | 
| @@ -1087,7 +1087,7 @@ discard block | ||
| 1087 | 1087 | |
| 1088 | 1088 | // These indicate not an entity. We return just | 
| 1089 | 1089 | // the &. | 
| 1090 | -        if (strspn($tok, static::WHITE . "&<") == 1) { | |
| 1090 | +        if (strspn($tok, static::WHITE."&<") == 1) { | |
| 1091 | 1091 | // $this->scanner->next(); | 
| 1092 | 1092 | return '&'; | 
| 1093 | 1093 | } | 
| @@ -1164,6 +1164,6 @@ discard block | ||
| 1164 | 1164 | } | 
| 1165 | 1165 | |
| 1166 | 1166 |          $this->parseError("Expected &ENTITY;, got &ENTITY%s (no trailing ;) ", $tok); | 
| 1167 | - return '&' . $entity; | |
| 1167 | + return '&'.$entity; | |
| 1168 | 1168 | } | 
| 1169 | 1169 | } | 
| @@ -298,13 +298,9 @@ | ||
| 298 | 298 | $this->scanner->next(); // Consume the other '-' | 
| 299 | 299 | $this->scanner->next(); // Next char. | 
| 300 | 300 | return $this->comment(); | 
| 301 | - } | |
| 302 | - | |
| 303 | -        elseif ($tok == 'D' || $tok == 'd') { // Doctype | |
| 301 | +        } elseif ($tok == 'D' || $tok == 'd') { // Doctype | |
| 304 | 302 | return $this->doctype(); | 
| 305 | - } | |
| 306 | - | |
| 307 | -        elseif ($tok == '[') { // CDATA section | |
| 303 | +        } elseif ($tok == '[') { // CDATA section | |
| 308 | 304 | return $this->cdataSection(); | 
| 309 | 305 | } | 
| 310 | 306 | |
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | /* | 
| 145 | 145 | * All U+0000 null characters in the input must be replaced by U+FFFD REPLACEMENT CHARACTERs. Any occurrences of such characters is a parse error. | 
| 146 | 146 | */ | 
| 147 | -        for ($i = 0, $count = substr_count($data, "\0"); $i < $count; $i ++) { | |
| 147 | +        for ($i = 0, $count = substr_count($data, "\0"); $i < $count; $i++) { | |
| 148 | 148 | $errors[] = 'null-character'; | 
| 149 | 149 | } | 
| 150 | 150 | |
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | | | 
| 167 | 167 |          [\xF0-\xF4][\x8F-\xBF]\xBF[\xBE\xBF] # U+nFFFE and U+nFFFF (1 <= n <= 10_{16}) | 
| 168 | 168 | )/x', $data, $matches); | 
| 169 | -        for ($i = 0; $i < $count; $i ++) { | |
| 169 | +        for ($i = 0; $i < $count; $i++) { | |
| 170 | 170 | $errors[] = 'invalid-codepoint'; | 
| 171 | 171 | } | 
| 172 | 172 | |
| @@ -242,7 +242,7 @@ discard block | ||
| 242 | 242 | $this->quirks = $quirks; | 
| 243 | 243 | |
| 244 | 244 |          if ($this->insertMode > static::IM_INITIAL) { | 
| 245 | -            $this->parseError("Illegal placement of DOCTYPE tag. Ignoring: " . $name); | |
| 245 | +            $this->parseError("Illegal placement of DOCTYPE tag. Ignoring: ".$name); | |
| 246 | 246 | |
| 247 | 247 | return; | 
| 248 | 248 | } | 
| @@ -263,7 +263,7 @@ discard block | ||
| 263 | 263 | $lname = $this->normalizeTagName($name); | 
| 264 | 264 | |
| 265 | 265 | // Make sure we have an html element. | 
| 266 | -        if (! $this->doc->documentElement && $name !== 'html' && ! $this->frag) { | |
| 266 | +        if (!$this->doc->documentElement && $name !== 'html' && !$this->frag) { | |
| 267 | 267 |              $this->startTag('html'); | 
| 268 | 268 | } | 
| 269 | 269 | |
| @@ -324,7 +324,7 @@ discard block | ||
| 324 | 324 | array_unshift($this->nsStack, array( | 
| 325 | 325 | '' => $this->nsRoots[$lname] | 
| 326 | 326 | ) + $this->nsStack[0]); | 
| 327 | - $pushes ++; | |
| 327 | + $pushes++; | |
| 328 | 328 | } | 
| 329 | 329 | $needsWorkaround = false; | 
| 330 | 330 |          if (isset($this->options["xmlNamespaces"]) && $this->options["xmlNamespaces"]) { | 
| @@ -335,12 +335,12 @@ discard block | ||
| 335 | 335 | array_unshift($this->nsStack, array( | 
| 336 | 336 | '' => $aVal | 
| 337 | 337 | ) + $this->nsStack[0]); | 
| 338 | - $pushes ++; | |
| 338 | + $pushes++; | |
| 339 | 339 |                  } elseif ((($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : '') === 'xmlns') { | 
| 340 | 340 | array_unshift($this->nsStack, array( | 
| 341 | 341 | substr($aName, $pos + 1) => $aVal | 
| 342 | 342 | ) + $this->nsStack[0]); | 
| 343 | - $pushes ++; | |
| 343 | + $pushes++; | |
| 344 | 344 | } | 
| 345 | 345 | } | 
| 346 | 346 | } | 
| @@ -354,9 +354,9 @@ discard block | ||
| 354 | 354 | $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : ''; | 
| 355 | 355 | |
| 356 | 356 | |
| 357 | -            if ($needsWorkaround!==false) { | |
| 357 | +            if ($needsWorkaround !== false) { | |
| 358 | 358 | |
| 359 | -                $xml = "<$lname xmlns=\"$needsWorkaround\" ".(strlen($prefix) && isset($this->nsStack[0][$prefix])?("xmlns:$prefix=\"".$this->nsStack[0][$prefix]."\""):"")."/>"; | |
| 359 | +                $xml = "<$lname xmlns=\"$needsWorkaround\" ".(strlen($prefix) && isset($this->nsStack[0][$prefix]) ? ("xmlns:$prefix=\"".$this->nsStack[0][$prefix]."\"") : "")."/>"; | |
| 360 | 360 | |
| 361 | 361 |                  $frag = new \DOMDocument('1.0', 'UTF-8'); | 
| 362 | 362 | $frag->loadXML($xml); | 
| @@ -409,9 +409,9 @@ discard block | ||
| 409 | 409 |              try { | 
| 410 | 410 | $prefix = ($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : false; | 
| 411 | 411 | |
| 412 | -                if ($prefix==='xmlns') { | |
| 412 | +                if ($prefix === 'xmlns') { | |
| 413 | 413 | $ele->setAttributeNs(self::NAMESPACE_XMLNS, $aName, $aVal); | 
| 414 | -                } elseif ($prefix!==false && isset($this->nsStack[0][$prefix])) { | |
| 414 | +                } elseif ($prefix !== false && isset($this->nsStack[0][$prefix])) { | |
| 415 | 415 | $ele->setAttributeNs($this->nsStack[0][$prefix], $aName, $aVal); | 
| 416 | 416 |                  } else { | 
| 417 | 417 | $ele->setAttribute($aName, $aVal); | 
| @@ -434,7 +434,7 @@ discard block | ||
| 434 | 434 |          else { | 
| 435 | 435 | $this->current->appendChild($ele); | 
| 436 | 436 | |
| 437 | -            if (! Elements::isA($name, Elements::VOID_TAG)) { | |
| 437 | +            if (!Elements::isA($name, Elements::VOID_TAG)) { | |
| 438 | 438 | $this->current = $ele; | 
| 439 | 439 | } | 
| 440 | 440 | |
| @@ -456,7 +456,7 @@ discard block | ||
| 456 | 456 | // but we have to remove the namespaces pushed to $nsStack. | 
| 457 | 457 |          if ($pushes > 0 && Elements::isA($name, Elements::VOID_TAG)) { | 
| 458 | 458 | // remove the namespaced definded by current node | 
| 459 | -            for ($i = 0; $i < $pushes; $i ++) { | |
| 459 | +            for ($i = 0; $i < $pushes; $i++) { | |
| 460 | 460 | array_shift($this->nsStack); | 
| 461 | 461 | } | 
| 462 | 462 | } | 
| @@ -525,14 +525,14 @@ discard block | ||
| 525 | 525 | |
| 526 | 526 | // remove the namespaced definded by current node | 
| 527 | 527 |          if (isset($this->pushes[$cid])) { | 
| 528 | -            for ($i = 0; $i < $this->pushes[$cid][0]; $i ++) { | |
| 528 | +            for ($i = 0; $i < $this->pushes[$cid][0]; $i++) { | |
| 529 | 529 | array_shift($this->nsStack); | 
| 530 | 530 | } | 
| 531 | 531 | unset($this->pushes[$cid]); | 
| 532 | 532 | } | 
| 533 | 533 | |
| 534 | -        if (! $this->autoclose($lname)) { | |
| 535 | -            $this->parseError('Could not find closing tag for ' . $lname); | |
| 534 | +        if (!$this->autoclose($lname)) { | |
| 535 | +            $this->parseError('Could not find closing tag for '.$lname); | |
| 536 | 536 | } | 
| 537 | 537 | |
| 538 | 538 |          // switch ($this->insertMode) { | 
| @@ -566,9 +566,9 @@ discard block | ||
| 566 | 566 | // practical as most documents contain these characters. Other text is not | 
| 567 | 567 | // expected here so recording a parse error is necessary. | 
| 568 | 568 | $dataTmp = trim($data, " \t\n\r\f"); | 
| 569 | -            if (! empty($dataTmp)) { | |
| 569 | +            if (!empty($dataTmp)) { | |
| 570 | 570 | // fprintf(STDOUT, "Unexpected insert mode: %d", $this->insertMode); | 
| 571 | -                $this->parseError("Unexpected text. Ignoring: " . $dataTmp); | |
| 571 | +                $this->parseError("Unexpected text. Ignoring: ".$dataTmp); | |
| 572 | 572 | } | 
| 573 | 573 | |
| 574 | 574 | return; | 
| @@ -610,7 +610,7 @@ discard block | ||
| 610 | 610 | // it sees fit. | 
| 611 | 611 |          if (isset($this->processor)) { | 
| 612 | 612 | $res = $this->processor->process($this->current, $name, $data); | 
| 613 | -            if (! empty($res)) { | |
| 613 | +            if (!empty($res)) { | |
| 614 | 614 | $this->current = $res; | 
| 615 | 615 | } | 
| 616 | 616 | |
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | } | 
| 237 | 237 | |
| 238 | 238 | // If not unary, add a closing tag. | 
| 239 | -        if (! Elements::isA($name, Elements::VOID_TAG)) { | |
| 239 | +        if (!Elements::isA($name, Elements::VOID_TAG)) { | |
| 240 | 240 | $this->closeTag($ele); | 
| 241 | 241 | } | 
| 242 | 242 | } | 
| @@ -288,11 +288,11 @@ discard block | ||
| 288 | 288 | */ | 
| 289 | 289 | protected function namespaceAttrs($ele) | 
| 290 | 290 |      { | 
| 291 | -        if (!$this->xpath || $this->xpath->document !== $ele->ownerDocument){ | |
| 291 | +        if (!$this->xpath || $this->xpath->document !== $ele->ownerDocument) { | |
| 292 | 292 | $this->xpath = new \DOMXPath($ele->ownerDocument); | 
| 293 | 293 | } | 
| 294 | 294 | |
| 295 | -        foreach( $this->xpath->query('namespace::*[not(.=../../namespace::*)]', $ele ) as $nsNode ) { | |
| 295 | +        foreach ($this->xpath->query('namespace::*[not(.=../../namespace::*)]', $ele) as $nsNode) { | |
| 296 | 296 |              if (!in_array($nsNode->nodeValue, $this->implicitNamespaces)) { | 
| 297 | 297 |                  $this->wr(' ')->wr($nsNode->nodeName)->wr('="')->wr($nsNode->nodeValue)->wr('"'); | 
| 298 | 298 | } | 
| @@ -333,7 +333,7 @@ discard block | ||
| 333 | 333 | protected function attrs($ele) | 
| 334 | 334 |      { | 
| 335 | 335 | // FIXME: Needs support for xml, xmlns, xlink, and namespaced elements. | 
| 336 | -        if (! $ele->hasAttributes()) { | |
| 336 | +        if (!$ele->hasAttributes()) { | |
| 337 | 337 | return $this; | 
| 338 | 338 | } | 
| 339 | 339 | |
| @@ -371,35 +371,35 @@ discard block | ||
| 371 | 371 | protected function nonBooleanAttribute(\DOMAttr $attr) | 
| 372 | 372 |      { | 
| 373 | 373 | $ele = $attr->ownerElement; | 
| 374 | -        foreach($this->nonBooleanAttributes as $rule){ | |
| 374 | +        foreach ($this->nonBooleanAttributes as $rule) { | |
| 375 | 375 | |
| 376 | -            if(isset($rule['nodeNamespace']) && $rule['nodeNamespace']!==$ele->namespaceURI){ | |
| 376 | +            if (isset($rule['nodeNamespace']) && $rule['nodeNamespace'] !== $ele->namespaceURI) { | |
| 377 | 377 | continue; | 
| 378 | 378 | } | 
| 379 | -            if(isset($rule['attNamespace']) && $rule['attNamespace']!==$attr->namespaceURI){ | |
| 379 | +            if (isset($rule['attNamespace']) && $rule['attNamespace'] !== $attr->namespaceURI) { | |
| 380 | 380 | continue; | 
| 381 | 381 | } | 
| 382 | -            if(isset($rule['nodeName']) && !is_array($rule['nodeName']) && $rule['nodeName']!==$ele->localName){ | |
| 382 | +            if (isset($rule['nodeName']) && !is_array($rule['nodeName']) && $rule['nodeName'] !== $ele->localName) { | |
| 383 | 383 | continue; | 
| 384 | 384 | } | 
| 385 | -            if(isset($rule['nodeName']) && is_array($rule['nodeName']) && !in_array($ele->localName, $rule['nodeName'], true)){ | |
| 385 | +            if (isset($rule['nodeName']) && is_array($rule['nodeName']) && !in_array($ele->localName, $rule['nodeName'], true)) { | |
| 386 | 386 | continue; | 
| 387 | 387 | } | 
| 388 | -            if(isset($rule['attrName']) && !is_array($rule['attrName']) && $rule['attrName']!==$attr->localName){ | |
| 388 | +            if (isset($rule['attrName']) && !is_array($rule['attrName']) && $rule['attrName'] !== $attr->localName) { | |
| 389 | 389 | continue; | 
| 390 | 390 | } | 
| 391 | -            if(isset($rule['attrName']) && is_array($rule['attrName']) && !in_array($attr->localName, $rule['attrName'], true)){ | |
| 391 | +            if (isset($rule['attrName']) && is_array($rule['attrName']) && !in_array($attr->localName, $rule['attrName'], true)) { | |
| 392 | 392 | continue; | 
| 393 | 393 | } | 
| 394 | -            if(isset($rule['xpath'])){ | |
| 394 | +            if (isset($rule['xpath'])) { | |
| 395 | 395 | |
| 396 | 396 | $xp = $this->getXPath($attr); | 
| 397 | -                if(isset($rule['prefixes'])){ | |
| 398 | -                    foreach($rule['prefixes'] as $nsPrefix => $ns){ | |
| 397 | +                if (isset($rule['prefixes'])) { | |
| 398 | +                    foreach ($rule['prefixes'] as $nsPrefix => $ns) { | |
| 399 | 399 | $xp->registerNamespace($nsPrefix, $ns); | 
| 400 | 400 | } | 
| 401 | 401 | } | 
| 402 | -                if(!$xp->evaluate($rule['xpath'], $attr)){ | |
| 402 | +                if (!$xp->evaluate($rule['xpath'], $attr)) { | |
| 403 | 403 | continue; | 
| 404 | 404 | } | 
| 405 | 405 | } | 
| @@ -410,8 +410,8 @@ discard block | ||
| 410 | 410 | return false; | 
| 411 | 411 | } | 
| 412 | 412 | |
| 413 | -    private function getXPath(\DOMNode $node){ | |
| 414 | -        if(!$this->xpath){ | |
| 413 | +    private function getXPath(\DOMNode $node) { | |
| 414 | +        if (!$this->xpath) { | |
| 415 | 415 | $this->xpath = new \DOMXPath($node->ownerDocument); | 
| 416 | 416 | } | 
| 417 | 417 | return $this->xpath; | 
| @@ -491,7 +491,7 @@ discard block | ||
| 491 | 491 |      { | 
| 492 | 492 | |
| 493 | 493 | // Escape the text rather than convert to named character references. | 
| 494 | -        if (! $this->encode) { | |
| 494 | +        if (!$this->encode) { | |
| 495 | 495 | return $this->escape($text, $attribute); | 
| 496 | 496 | } | 
| 497 | 497 | |
| @@ -168,7 +168,7 @@ discard block | ||
| 168 | 168 | $options = array_merge($this->getOptions(), $options); | 
| 169 | 169 | $events = new DOMTreeBuilder(false, $options); | 
| 170 | 170 | $scanner = new Scanner($input); | 
| 171 | - $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML: Tokenizer::CONFORMANT_HTML); | |
| 171 | + $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); | |
| 172 | 172 | |
| 173 | 173 | $parser->parse(); | 
| 174 | 174 | $this->errors = $events->getErrors(); | 
| @@ -187,7 +187,7 @@ discard block | ||
| 187 | 187 | $options = array_merge($this->getOptions(), $options); | 
| 188 | 188 | $events = new DOMTreeBuilder(true, $options); | 
| 189 | 189 | $scanner = new Scanner($input); | 
| 190 | - $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML: Tokenizer::CONFORMANT_HTML); | |
| 190 | + $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); | |
| 191 | 191 | |
| 192 | 192 | $parser->parse(); | 
| 193 | 193 | $this->errors = $events->getErrors(); |