@@ -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 |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | if ($this->onlyInline && Elements::isA($lname, Elements::BLOCK_TAG)) { |
347 | - $this->autoclose($this->onlyInline); |
|
348 | - $this->onlyInline = null; |
|
347 | + $this->autoclose($this->onlyInline); |
|
348 | + $this->onlyInline = null; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | try { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | if (Elements::isA($lname, Elements::BLOCK_ONLY_INLINE)) { |
378 | - $this->onlyInline = $lname; |
|
378 | + $this->onlyInline = $lname; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | // When we add some namespacess, we have to track them. Later, when "endElement" is invoked, we have to remove them. |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $this->quirks = $quirks; |
250 | 250 | |
251 | 251 | if ($this->insertMode > static::IM_INITIAL) { |
252 | - $this->parseError("Illegal placement of DOCTYPE tag. Ignoring: " . $name); |
|
252 | + $this->parseError("Illegal placement of DOCTYPE tag. Ignoring: ".$name); |
|
253 | 253 | |
254 | 254 | return; |
255 | 255 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $lname = $this->normalizeTagName($name); |
271 | 271 | |
272 | 272 | // Make sure we have an html element. |
273 | - if (! $this->doc->documentElement && $name !== 'html' && ! $this->frag) { |
|
273 | + if (!$this->doc->documentElement && $name !== 'html' && !$this->frag) { |
|
274 | 274 | $this->startTag('html'); |
275 | 275 | } |
276 | 276 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | array_unshift($this->nsStack, array( |
331 | 331 | '' => $this->nsRoots[$lname] |
332 | 332 | ) + $this->nsStack[0]); |
333 | - $pushes ++; |
|
333 | + $pushes++; |
|
334 | 334 | } |
335 | 335 | $needsWorkaround = false; |
336 | 336 | if (isset($this->options["xmlNamespaces"]) && $this->options["xmlNamespaces"]) { |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | array_unshift($this->nsStack, array( |
342 | 342 | '' => $aVal |
343 | 343 | ) + $this->nsStack[0]); |
344 | - $pushes ++; |
|
344 | + $pushes++; |
|
345 | 345 | } elseif ((($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : '') === 'xmlns') { |
346 | 346 | array_unshift($this->nsStack, array( |
347 | 347 | substr($aName, $pos + 1) => $aVal |
348 | 348 | ) + $this->nsStack[0]); |
349 | - $pushes ++; |
|
349 | + $pushes++; |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | } |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : ''; |
361 | 361 | |
362 | 362 | |
363 | - if ($needsWorkaround!==false) { |
|
363 | + if ($needsWorkaround !== false) { |
|
364 | 364 | |
365 | - $xml = "<$lname xmlns=\"$needsWorkaround\" ".(strlen($prefix) && isset($this->nsStack[0][$prefix])?("xmlns:$prefix=\"".$this->nsStack[0][$prefix]."\""):"")."/>"; |
|
365 | + $xml = "<$lname xmlns=\"$needsWorkaround\" ".(strlen($prefix) && isset($this->nsStack[0][$prefix]) ? ("xmlns:$prefix=\"".$this->nsStack[0][$prefix]."\"") : "")."/>"; |
|
366 | 366 | |
367 | 367 | $frag = new \DOMDocument('1.0', 'UTF-8'); |
368 | 368 | $frag->loadXML($xml); |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | try { |
416 | 416 | $prefix = ($pos = strpos($aName, ':')) ? substr($aName, 0, $pos) : false; |
417 | 417 | |
418 | - if ($prefix==='xmlns') { |
|
418 | + if ($prefix === 'xmlns') { |
|
419 | 419 | $ele->setAttributeNs(self::NAMESPACE_XMLNS, $aName, $aVal); |
420 | - } elseif ($prefix!==false && isset($this->nsStack[0][$prefix])) { |
|
420 | + } elseif ($prefix !== false && isset($this->nsStack[0][$prefix])) { |
|
421 | 421 | $ele->setAttributeNs($this->nsStack[0][$prefix], $aName, $aVal); |
422 | 422 | } else { |
423 | 423 | $ele->setAttribute($aName, $aVal); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $this->current->appendChild($ele); |
442 | 442 | |
443 | 443 | // XXX: Need to handle self-closing tags and unary tags. |
444 | - if (! Elements::isA($name, Elements::VOID_TAG)) { |
|
444 | + if (!Elements::isA($name, Elements::VOID_TAG)) { |
|
445 | 445 | $this->current = $ele; |
446 | 446 | } |
447 | 447 | } |
@@ -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 | } |
@@ -520,14 +520,14 @@ discard block |
||
520 | 520 | |
521 | 521 | // remove the namespaced definded by current node |
522 | 522 | if (isset($this->pushes[$cid])) { |
523 | - for ($i = 0; $i < $this->pushes[$cid][0]; $i ++) { |
|
523 | + for ($i = 0; $i < $this->pushes[$cid][0]; $i++) { |
|
524 | 524 | array_shift($this->nsStack); |
525 | 525 | } |
526 | 526 | unset($this->pushes[$cid]); |
527 | 527 | } |
528 | 528 | |
529 | - if (! $this->autoclose($lname)) { |
|
530 | - $this->parseError('Could not find closing tag for ' . $lname); |
|
529 | + if (!$this->autoclose($lname)) { |
|
530 | + $this->parseError('Could not find closing tag for '.$lname); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | // switch ($this->insertMode) { |
@@ -561,9 +561,9 @@ discard block |
||
561 | 561 | // practical as most documents contain these characters. Other text is not |
562 | 562 | // expected here so recording a parse error is necessary. |
563 | 563 | $dataTmp = trim($data, " \t\n\r\f"); |
564 | - if (! empty($dataTmp)) { |
|
564 | + if (!empty($dataTmp)) { |
|
565 | 565 | $this->logger->debug(sprintf("Unexpected insert mode: %d", $this->insertMode)); |
566 | - $this->parseError("Unexpected text. Ignoring: " . $dataTmp); |
|
566 | + $this->parseError("Unexpected text. Ignoring: ".$dataTmp); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | return; |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | // it sees fit. |
606 | 606 | if (isset($this->processor)) { |
607 | 607 | $res = $this->processor->process($this->current, $name, $data); |
608 | - if (! empty($res)) { |
|
608 | + if (!empty($res)) { |
|
609 | 609 | $this->current = $res; |
610 | 610 | } |
611 | 611 |
@@ -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 | /** |
@@ -71,8 +71,9 @@ |
||
71 | 71 | public function __construct($data, $encoding = 'UTF-8', $debug = '') |
72 | 72 | { |
73 | 73 | $data = UTF8Utils::convertToUTF8($data, $encoding); |
74 | - if ($debug) |
|
75 | - fprintf(STDOUT, $debug, $data, strlen($data)); |
|
74 | + if ($debug) { |
|
75 | + fprintf(STDOUT, $debug, $data, strlen($data)); |
|
76 | + } |
|
76 | 77 | |
77 | 78 | // There is good reason to question whether it makes sense to |
78 | 79 | // do this here, since most of these checks are done during |
@@ -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 |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | if (is_null($this->untilTag)) { |
192 | 192 | return $this->text(); |
193 | 193 | } |
194 | - $sequence = '</' . $this->untilTag . '>'; |
|
194 | + $sequence = '</'.$this->untilTag.'>'; |
|
195 | 195 | $txt = $this->readUntilSequence($sequence); |
196 | 196 | $this->events->text($txt); |
197 | 197 | $this->setTextMode(0); |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | if (is_null($this->untilTag)) { |
207 | 207 | return $this->text(); |
208 | 208 | } |
209 | - $sequence = '</' . $this->untilTag; |
|
209 | + $sequence = '</'.$this->untilTag; |
|
210 | 210 | $txt = ''; |
211 | 211 | $tok = $this->scanner->current(); |
212 | 212 | |
213 | 213 | $caseSensitive = !Elements::isHtml5Element($this->untilTag); |
214 | - while ($tok !== false && ! ($tok == '<' && ($this->sequenceMatches($sequence, $caseSensitive)))) { |
|
214 | + while ($tok !== false && !($tok == '<' && ($this->sequenceMatches($sequence, $caseSensitive)))) { |
|
215 | 215 | if ($tok == '&') { |
216 | 216 | $txt .= $this->decodeCharacterReference(); |
217 | 217 | $tok = $this->scanner->current(); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | // > -> parse error |
337 | 337 | // EOF -> parse error |
338 | 338 | // -> parse error |
339 | - if (! ctype_alpha($tok)) { |
|
339 | + if (!ctype_alpha($tok)) { |
|
340 | 340 | $this->parseError("Expected tag name, got '%s'", $tok); |
341 | 341 | if ($tok == "\0" || $tok === false) { |
342 | 342 | return false; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | $name = $this->scanner->charsUntil("\n\f \t>"); |
348 | - $name = $this->mode === self::CONFORMANT_XML ? $name: strtolower($name); |
|
348 | + $name = $this->mode === self::CONFORMANT_XML ? $name : strtolower($name); |
|
349 | 349 | // Trash whitespace. |
350 | 350 | $this->scanner->whitespace(); |
351 | 351 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | protected function tagName() |
368 | 368 | { |
369 | 369 | $tok = $this->scanner->current(); |
370 | - if (! ctype_alpha($tok)) { |
|
370 | + if (!ctype_alpha($tok)) { |
|
371 | 371 | return false; |
372 | 372 | } |
373 | 373 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | do { |
384 | 384 | $this->scanner->whitespace(); |
385 | 385 | $this->attribute($attributes); |
386 | - } while (! $this->isTagEnd($selfClose)); |
|
386 | + } while (!$this->isTagEnd($selfClose)); |
|
387 | 387 | } catch (ParseError $e) { |
388 | 388 | $selfClose = false; |
389 | 389 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | */ |
543 | 543 | protected function quotedAttributeValue($quote) |
544 | 544 | { |
545 | - $stoplist = "\f" . $quote; |
|
545 | + $stoplist = "\f".$quote; |
|
546 | 546 | $val = ''; |
547 | 547 | $tok = $this->scanner->current(); |
548 | 548 | while (strspn($tok, $stoplist) == 0 && $tok !== false) { |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | } while ($tok !== false && $tok != '>'); |
609 | 609 | |
610 | 610 | $this->flushBuffer(); |
611 | - $this->events->comment($comment . $tok); |
|
611 | + $this->events->comment($comment.$tok); |
|
612 | 612 | $this->scanner->next(); |
613 | 613 | |
614 | 614 | return true; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | if ($tok == "\0") { |
638 | 638 | $tok = UTF8Utils::FFFD; |
639 | 639 | } |
640 | - while (! $this->isCommentEnd()) { |
|
640 | + while (!$this->isCommentEnd()) { |
|
641 | 641 | $comment .= $tok; |
642 | 642 | $this->scanner->next(); |
643 | 643 | $tok = $this->scanner->current(); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $chars = $this->scanner->charsWhile("DOCTYPEdoctype"); |
694 | 694 | if (strcasecmp($chars, 'DOCTYPE')) { |
695 | 695 | $this->parseError('Expected DOCTYPE, got %s', $chars); |
696 | - return $this->bogusComment('<!' . $chars); |
|
696 | + return $this->bogusComment('<!'.$chars); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | $this->scanner->whitespace(); |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | $tok = $this->scanner->current(); |
806 | 806 | if ($tok == '"' || $tok == "'") { |
807 | 807 | $this->scanner->next(); |
808 | - $ret = $this->scanner->charsUntil($tok . $stopchars); |
|
808 | + $ret = $this->scanner->charsUntil($tok.$stopchars); |
|
809 | 809 | if ($this->scanner->current() == $tok) { |
810 | 810 | $this->scanner->next(); |
811 | 811 | } else { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $chars = $this->scanner->charsWhile('CDAT'); |
832 | 832 | if ($chars != 'CDATA' || $this->scanner->current() != '[') { |
833 | 833 | $this->parseError('Expected [CDATA[, got %s', $chars); |
834 | - return $this->bogusComment('<![' . $chars); |
|
834 | + return $this->bogusComment('<!['.$chars); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | $this->scanner->next(); |
@@ -839,13 +839,13 @@ discard block |
||
839 | 839 | do { |
840 | 840 | if ($tok === false) { |
841 | 841 | $this->parseError('Unexpected EOF inside CDATA.'); |
842 | - $this->bogusComment('<![CDATA[' . $cdata); |
|
842 | + $this->bogusComment('<![CDATA['.$cdata); |
|
843 | 843 | return true; |
844 | 844 | } |
845 | 845 | $cdata .= $tok; |
846 | 846 | $this->scanner->next(); |
847 | 847 | $tok = $this->scanner->current(); |
848 | - } while (! $this->sequenceMatches(']]>')); |
|
848 | + } while (!$this->sequenceMatches(']]>')); |
|
849 | 849 | |
850 | 850 | // Consume ]]> |
851 | 851 | $this->scanner->consume(3); |
@@ -879,13 +879,13 @@ discard block |
||
879 | 879 | // If not a PI, send to bogusComment. |
880 | 880 | if (strlen($procName) == 0 || $white == 0 || $this->scanner->current() == false) { |
881 | 881 | $this->parseError("Expected processing instruction name, got $tok"); |
882 | - $this->bogusComment('<?' . $tok . $procName); |
|
882 | + $this->bogusComment('<?'.$tok.$procName); |
|
883 | 883 | return true; |
884 | 884 | } |
885 | 885 | |
886 | 886 | $data = ''; |
887 | 887 | // As long as it's not the case that the next two chars are ? and >. |
888 | - while (! ($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { |
|
888 | + while (!($this->scanner->current() == '?' && $this->scanner->peek() == '>')) { |
|
889 | 889 | $data .= $this->scanner->current(); |
890 | 890 | |
891 | 891 | $this->scanner->next(); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | // These indicate not an entity. We return just |
1044 | 1044 | // the &. |
1045 | - if (strspn($tok, static::WHITE . "&<") == 1) { |
|
1045 | + if (strspn($tok, static::WHITE."&<") == 1) { |
|
1046 | 1046 | // $this->scanner->next(); |
1047 | 1047 | return '&'; |
1048 | 1048 | } |
@@ -1117,6 +1117,6 @@ discard block |
||
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | $this->parseError("Expected &ENTITY;, got &ENTITY%s (no trailing ;) ", $tok); |
1120 | - return '&' . $entity; |
|
1120 | + return '&'.$entity; |
|
1121 | 1121 | } |
1122 | 1122 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public static function checkForIllegalCodepoints($data) |
132 | 132 | { |
133 | - if (! function_exists('preg_match_all')) { |
|
133 | + if (!function_exists('preg_match_all')) { |
|
134 | 134 | throw\Exception('The PCRE library is not loaded or is not available.'); |
135 | 135 | } |
136 | 136 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | /* |
141 | 141 | * 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. |
142 | 142 | */ |
143 | - for ($i = 0, $count = substr_count($data, "\0"); $i < $count; $i ++) { |
|
143 | + for ($i = 0, $count = substr_count($data, "\0"); $i < $count; $i++) { |
|
144 | 144 | $errors[] = 'null-character'; |
145 | 145 | } |
146 | 146 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | | |
163 | 163 | [\xF0-\xF4][\x8F-\xBF]\xBF[\xBE\xBF] # U+nFFFE and U+nFFFF (1 <= n <= 10_{16}) |
164 | 164 | )/x', $data, $matches); |
165 | - for ($i = 0; $i < $count; $i ++) { |
|
165 | + for ($i = 0; $i < $count; $i++) { |
|
166 | 166 | $errors[] = 'invalid-codepoint'; |
167 | 167 | } |
168 | 168 |
@@ -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 |
@@ -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'); |
@@ -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(); |