Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
55 / 55
Initial
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
5 / 5
28
100.00% covered (success)
100.00%
55 / 55
 characters
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
11 / 11
 startTag
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
6 / 6
 endTag
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
6 / 6
 doctype
100.00% covered (success)
100.00%
1 / 1
19
100.00% covered (success)
100.00%
26 / 26
 endDocument
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
6 / 6
<?php
namespace RemexHtml\TreeBuilder;
use RemexHtml\HTMLData;
use RemexHtml\Tokenizer\Attributes;
/**
 * The "initial" insertion mode
 */
class Initial extends InsertionMode {
    /**
     * The doctypes listed in the spec which are allowed without generating a
     * parse error. A 2-d array where each row gives the doctype name, the
     * public identifier and the system identifier.
     */
    private static $allowedDoctypes = [
        [ 'html', '-//W3C//DTD HTML 4.0//EN', null ],
        [ 'html', '-//W3C//DTD HTML 4.0//EN', 'http://www.w3.org/TR/REC-html40/strict.dtd' ],
        [ 'html', '-//W3C//DTD HTML 4.01//EN', null ],
        [ 'html', '-//W3C//DTD HTML 4.01//EN', 'http://www.w3.org/TR/html4/strict.dtd' ],
        [ 'html', '-//W3C//DTD XHTML 1.0 Strict//EN',
            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' ],
        [ 'html', '-//W3C//DTD XHTML 1.1//EN', 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd' ]
    ];
    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;
        }
        if ( !$this->builder->isIframeSrcdoc ) {
            $this->error( 'missing doctype', $sourceStart );
            $this->builder->quirks = TreeBuilder::QUIRKS;
        }
        $this->dispatcher->switchMode( Dispatcher::BEFORE_HTML )
            ->characters( $text, $start, $length, $sourceStart, $sourceLength );
    }
    public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {