Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
MediaHandler | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
handle | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace Wikimedia\Parsoid\Html2Wt\DOMHandlers; |
5 | |
6 | use Wikimedia\Parsoid\Core\MediaStructure; |
7 | use Wikimedia\Parsoid\DOM\Element; |
8 | use Wikimedia\Parsoid\DOM\Node; |
9 | use Wikimedia\Parsoid\Html2Wt\LinkHandlerUtils; |
10 | use Wikimedia\Parsoid\Html2Wt\SerializerState; |
11 | use Wikimedia\Parsoid\Utils\DOMCompat; |
12 | |
13 | class 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 | } |