@@ -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 | /** |
@@ -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 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | return $this->text($tok); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $sequence = '</' . $this->untilTag . '>'; |
|
| 244 | + $sequence = '</'.$this->untilTag.'>'; |
|
| 245 | 245 | $txt = $this->readUntilSequence($sequence); |
| 246 | 246 | $this->events->text($txt); |
| 247 | 247 | $this->setTextMode(0); |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | return $this->text($tok); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - $sequence = '</' . $this->untilTag; |
|
| 265 | + $sequence = '</'.$this->untilTag; |
|
| 266 | 266 | $txt = ''; |
| 267 | 267 | |
| 268 | 268 | $caseSensitive = !Elements::isHtml5Element($this->untilTag); |
| 269 | - while ($tok !== false && ! ($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) { |
|
| 269 | + while ($tok !== false && !($tok == '<' && ($this->scanner->sequenceMatches($sequence, $caseSensitive)))) { |
|
| 270 | 270 | if ($tok == '&') { |
| 271 | 271 | $txt .= $this->decodeCharacterReference(); |
| 272 | 272 | $tok = $this->scanner->current(); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | // > -> parse error |
| 354 | 354 | // EOF -> parse error |
| 355 | 355 | // -> parse error |
| 356 | - if (! ctype_alpha($tok)) { |
|
| 356 | + if (!ctype_alpha($tok)) { |
|
| 357 | 357 | $this->parseError("Expected tag name, got '%s'", $tok); |
| 358 | 358 | if ($tok == "\0" || $tok === false) { |
| 359 | 359 | return false; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | $name = $this->scanner->charsUntil("\n\f \t>"); |
| 365 | - $name = $this->mode === self::CONFORMANT_XML ? $name: strtolower($name); |
|
| 365 | + $name = $this->mode === self::CONFORMANT_XML ? $name : strtolower($name); |
|
| 366 | 366 | // Trash whitespace. |
| 367 | 367 | $this->scanner->whitespace(); |
| 368 | 368 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | protected function tagName() |
| 386 | 386 | { |
| 387 | 387 | $tok = $this->scanner->current(); |
| 388 | - if (! ctype_alpha($tok)) { |
|
| 388 | + if (!ctype_alpha($tok)) { |
|
| 389 | 389 | return false; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | do { |
| 402 | 402 | $this->scanner->whitespace(); |
| 403 | 403 | $this->attribute($attributes); |
| 404 | - } while (! $this->isTagEnd($selfClose)); |
|
| 404 | + } while (!$this->isTagEnd($selfClose)); |
|
| 405 | 405 | } catch (ParseError $e) { |
| 406 | 406 | $selfClose = false; |
| 407 | 407 | } |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | */ |
| 569 | 569 | protected function quotedAttributeValue($quote) |
| 570 | 570 | { |
| 571 | - $stoplist = "\f" . $quote; |
|
| 571 | + $stoplist = "\f".$quote; |
|
| 572 | 572 | $val = ''; |
| 573 | 573 | |
| 574 | 574 | while (true) { |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | if ($tok == "\0") { |
| 670 | 670 | $tok = UTF8Utils::FFFD; |
| 671 | 671 | } |
| 672 | - while (! $this->isCommentEnd()) { |
|
| 672 | + while (!$this->isCommentEnd()) { |
|
| 673 | 673 | $comment .= $tok; |
| 674 | 674 | $tok = $this->scanner->next(); |
| 675 | 675 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | $chars = $this->scanner->charsWhile("DOCTYPEdoctype"); |
| 730 | 730 | if (strcasecmp($chars, 'DOCTYPE')) { |
| 731 | 731 | $this->parseError('Expected DOCTYPE, got %s', $chars); |
| 732 | - return $this->bogusComment('<!' . $chars); |
|
| 732 | + return $this->bogusComment('<!'.$chars); |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | $this->scanner->whitespace(); |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | $tok = $this->scanner->current(); |
| 837 | 837 | if ($tok == '"' || $tok == "'") { |
| 838 | 838 | $this->scanner->next(); |
| 839 | - $ret = $this->scanner->charsUntil($tok . $stopchars); |
|
| 839 | + $ret = $this->scanner->charsUntil($tok.$stopchars); |
|
| 840 | 840 | if ($this->scanner->current() == $tok) { |
| 841 | 841 | $this->scanner->next(); |
| 842 | 842 | } else { |
@@ -864,19 +864,19 @@ discard block |
||
| 864 | 864 | $chars = $this->scanner->charsWhile('CDAT'); |
| 865 | 865 | if ($chars != 'CDATA' || $this->scanner->current() != '[') { |
| 866 | 866 | $this->parseError('Expected [CDATA[, got %s', $chars); |
| 867 | - return $this->bogusComment('<![' . $chars); |
|
| 867 | + return $this->bogusComment('<!['.$chars); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | $tok = $this->scanner->next(); |
| 871 | 871 | do { |
| 872 | 872 | if ($tok === false) { |
| 873 | 873 | $this->parseError('Unexpected EOF inside CDATA.'); |
| 874 | - $this->bogusComment('<![CDATA[' . $cdata); |
|
| 874 | + $this->bogusComment('<![CDATA['.$cdata); |
|
| 875 | 875 | return true; |
| 876 | 876 | } |
| 877 | 877 | $cdata .= $tok; |
| 878 | 878 | $tok = $this->scanner->next(); |
| 879 | - } while (! $this->scanner->sequenceMatches(']]>')); |
|
| 879 | + } while (!$this->scanner->sequenceMatches(']]>')); |
|
| 880 | 880 | |
| 881 | 881 | // Consume ]]> |
| 882 | 882 | $this->scanner->consume(3); |
@@ -911,13 +911,13 @@ discard block |
||
| 911 | 911 | // If not a PI, send to bogusComment. |
| 912 | 912 | if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) { |
| 913 | 913 | $this->parseError("Expected processing instruction name, got $tok"); |
| 914 | - $this->bogusComment('<?' . $tok . $procName); |
|
| 914 | + $this->bogusComment('<?'.$tok.$procName); |
|
| 915 | 915 | return true; |
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | $data = ''; |
| 919 | 919 | // As long as it's not the case that the next two chars are ? and >. |
| 920 | - while (! ($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { |
|
| 920 | + while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { |
|
| 921 | 921 | $data .= $this->scanner->current(); |
| 922 | 922 | |
| 923 | 923 | $tok = $this->scanner->next(); |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | */ |
| 989 | 989 | protected function sequenceMatches($sequence, $caseSensitive = true) |
| 990 | 990 | { |
| 991 | - @trigger_error(__METHOD__ . ' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED); |
|
| 991 | + @trigger_error(__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. Use Scanner::sequenceMatches() instead.', E_USER_DEPRECATED); |
|
| 992 | 992 | |
| 993 | 993 | return $this->scanner->sequenceMatches($sequence, $caseSensitive); |
| 994 | 994 | } |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | |
| 1071 | 1071 | // These indicate not an entity. We return just |
| 1072 | 1072 | // the &. |
| 1073 | - if ($tok === "\t" || $tok === "\n" || $tok === "\f" ||$tok === ' ' || $tok === '&' || $tok === '<') { |
|
| 1073 | + if ($tok === "\t" || $tok === "\n" || $tok === "\f" || $tok === ' ' || $tok === '&' || $tok === '<') { |
|
| 1074 | 1074 | // $this->scanner->next(); |
| 1075 | 1075 | return '&'; |
| 1076 | 1076 | } |
@@ -1147,6 +1147,6 @@ discard block |
||
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | $this->parseError("Expected &ENTITY;, got &ENTITY%s (no trailing ;) ", $tok); |
| 1150 | - return '&' . $entity; |
|
| 1150 | + return '&'.$entity; |
|
| 1151 | 1151 | } |
| 1152 | 1152 | } |
@@ -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(); |