Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
MediaHandler
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 handle
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Html2Wt\DOMHandlers;
5
6use Wikimedia\Parsoid\Core\MediaStructure;
7use Wikimedia\Parsoid\DOM\Element;
8use Wikimedia\Parsoid\DOM\Node;
9use Wikimedia\Parsoid\Html2Wt\LinkHandlerUtils;
10use Wikimedia\Parsoid\Html2Wt\SerializerState;
11use Wikimedia\Parsoid\Utils\DOMCompat;
12
13class MediaHandler extends DOMHandler {
14
15    public function __construct() {
16        parent::__construct( false );
17    }
18
19    /** @inheritDoc */
20    public function handle(
21        Element $node, SerializerState $state, bool $wrapperUnmodified = false
22    ): ?Node {
23        if ( DOMCompat::nodeName( $node ) === 'figure-inline' ) {
24            $ms = MediaStructure::parse( $node );
25        } else {
26            $ms = new MediaStructure( $node );
27        }
28        LinkHandlerUtils::figureHandler( $state, $node, $ms );
29        return $node->nextSibling;
30    }
31
32}