Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
30 / 30
BeforeHtml
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
4 / 4
7
100.00% covered (success)
100.00%
30 / 30
 characters
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
9 / 9
 startTag
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
9 / 9
 endTag
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
8 / 8
 endDocument
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
<?php
namespace RemexHtml\TreeBuilder;
use RemexHtml\Tokenizer\Attributes;
use RemexHtml\Tokenizer\PlainAttributes;
/**
 * The "before html" insertion mode
 */
class BeforeHtml extends InsertionMode {
    public function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
        // Ignore whitespace
        list( $part1, $part2 ) = $this->splitInitialMatch(
            true, "\t\n\f\r ", $text, $start, $length, $sourceStart, $sourceLength );
        list( $start, $length, $sourceStart, $sourceLength ) = $part2;
        if ( !$length ) {
            return;
        }
        // Generate missing <html> tag
        $this->builder->insertElement( 'html', new PlainAttributes, false, $sourceStart, 0 );
        $this->dispatcher->switchMode( Dispatcher::BEFORE_HEAD )
            ->characters( $text, $start, $length, $sourceStart, $sourceLength );
    }
    public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {