Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
75.00% covered (warning)
75.00%
3 / 4
CRAP
93.88% covered (success)
93.88%
46 / 49
InSelectInTable
0.00% covered (danger)
0.00%
0 / 1
75.00% covered (warning)
75.00%
3 / 4
21.10
93.88% covered (success)
93.88%
46 / 49
 characters
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 startTag
100.00% covered (success)
100.00%
1 / 1
9
100.00% covered (success)
100.00%
20 / 20
 endTag
0.00% covered (danger)
0.00%
0 / 1
10.20
87.50% covered (warning)
87.50%
21 / 24
 endDocument
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
namespace RemexHtml\TreeBuilder;
use RemexHtml\Tokenizer\Attributes;
/**
 * The "in select in table" insertion mode
 */
class InSelectInTable extends InsertionMode {
    public function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
        $this->dispatcher->inSelect->characters(
            $text, $start, $length, $sourceStart, $sourceLength );
    }
    public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
        $builder = $this->builder;
        $dispatcher = $this->dispatcher;
        switch ( $name ) {
        case 'caption':
        case 'table':
        case 'tbody':
        case 'tfoot':
        case 'thead':
        case 'tr':
        case 'td':
        case 'th':
            $builder->error( "unexpected <$name> in select in table, closing select",
                $sourceStart );
            $builder->popAllUpToName( 'select', $sourceStart, 0 );
            $dispatcher->reset()
                ->startTag( $name, $attrs, $selfClose, $sourceStart, $sourceLength );
            break;
        default:
            $dispatcher->inSelect->startTag(
                $name, $attrs, $selfClose, $sourceStart, $sourceLength );
        }
    }
    public function endTag( $name, $sourceStart, $sourceLength ) {
        $builder = $this->builder;
        $stack = $builder->stack;
        $dispatcher = $this->dispatcher;
        switch ( $name ) {
        case 'caption':
        case 'table':
        case 'tbody':
        case 'tfoot':
        case 'thead':
        case 'tr':
        case 'td':
        case 'th':
            if ( !$stack->isInTableScope( $name ) ) {
                $builder->error( "unexpected </$name> in select in table, ignoring",
                    $sourceStart );
                return;
            }
            $builder->error( "unexpected </$name> in select in table, closing select",
                $sourceStart );
            $builder->popAllUpToName( 'select', $sourceStart, 0 );
            $dispatcher->reset()
                ->endTag( $name, $sourceStart, $sourceLength );
            break;
        default:
            $dispatcher->inSelect->endTag( $name, $sourceStart, $sourceLength );
        }
    }
    public function endDocument( $pos ) {
        $this->dispatcher->inSelect->endDocument( $pos );
    }
}