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
98.80% covered (success)
98.80%
82 / 83
InRow
0.00% covered (danger)
0.00%
0 / 1
75.00% covered (warning)
75.00%
3 / 4
30
98.78% covered (success)
98.78%
81 / 82
 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
11
100.00% covered (success)
100.00%
30 / 30
 endTag
0.00% covered (danger)
0.00%
0 / 1
17
97.87% covered (success)
97.87%
46 / 47
 endDocument
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
namespace Wikimedia\RemexHtml\TreeBuilder;
use Wikimedia\RemexHtml\Tokenizer\Attributes;
/**
 * The "in row" insertion mode
 */
class InRow extends InsertionMode {
    private static $tableRowContext = [
        'tr' => true,
        'template' => true,
        'html' => true,
    ];
    public function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
        $this->dispatcher->inTable->characters( $text, $start, $length,
            $sourceStart, $sourceLength );
    }
    public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
        $builder = $this->builder;
        $stack = $builder->stack;
        $dispatcher = $this->dispatcher;
        switch ( $name ) {
        case 'th':
        case 'td':
            $builder->clearStackBack( self::$tableRowContext, $sourceStart );
            $builder->insertElement( $name, $attrs, false, $sourceStart, $sourceLength );
            $dispatcher->switchMode( Dispatcher::IN_CELL );
            $builder->afe->insertMarker();
            break;
        case 'caption':
        case 'col':
        case 'colgroup':
        case 'tbody':
        case 'tfoot':
        case 'thead':
        case 'tr':
            if ( !$stack->isInTableScope( 'tr' ) ) {
                $builder->error( "<$name> should close the tr but it is not in scope",
                    $sourceStart );
                // Ignore
                return;
            }
            $builder->clearStackBack( self::$tableRowContext, $sourceStart );
            $builder->pop( $sourceStart, 0 );
            $dispatcher->switchMode( Dispatcher::IN_TABLE_BODY )
                ->startTag( $name, $attrs, $selfClose, $sourceStart, $sourceLength );
            break;
        default: