Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
AfterFrameset
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
4 / 4
9
100.00% covered (success)
100.00%
1 / 1
 characters
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 startTag
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
4
 endTag
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
3
 endDocument
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Wikimedia\RemexHtml\TreeBuilder;
4
5use Wikimedia\RemexHtml\Tokenizer\Attributes;
6
7/**
8 * The "after frameset" insertion mode
9 */
10class AfterFrameset extends InsertionMode {
11    public function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
12        $this->handleFramesetWhitespace( false, $text, $start, $length, $sourceStart, $sourceLength );
13    }
14
15    public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
16        $builder = $this->builder;
17        $dispatcher = $this->dispatcher;
18
19        switch ( $name ) {
20            case 'html':
21                $dispatcher->inBody->startTag(
22                    $name, $attrs, $selfClose, $sourceStart, $sourceLength );
23                break;
24
25            case 'noframes':
26                $dispatcher->inHead->startTag(
27                    $name, $attrs, $selfClose, $sourceStart, $sourceLength );
28                break;
29
30            default:
31                $builder->error( "unexpected start tag after frameset, ignoring", $sourceStart );
32                return;
33        }
34    }
35
36    public function endTag( $name, $sourceStart, $sourceLength ) {
37        $builder = $this->builder;
38        $dispatcher = $this->dispatcher;
39
40        switch ( $name ) {
41            case 'html':
42                $dispatcher->switchMode( Dispatcher::AFTER_AFTER_FRAMESET );
43                break;
44
45            default:
46                $builder->error( "unexpected end tag after frameset, ignoring", $sourceStart );
47        }
48    }
49
50    public function endDocument( $pos ) {
51        $this->builder->stopParsing( $pos );
52    }
53}