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 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
HRHandler
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 4
20
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 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 before
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 after
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Html2Wt\DOMHandlers;
5
6use Wikimedia\Parsoid\DOM\Element;
7use Wikimedia\Parsoid\DOM\Node;
8use Wikimedia\Parsoid\Html2Wt\SerializerState;
9use Wikimedia\Parsoid\Utils\DOMDataUtils;
10
11class HRHandler extends DOMHandler {
12
13    public function __construct() {
14        parent::__construct( false );
15    }
16
17    /** @inheritDoc */
18    public function handle(
19        Element $node, SerializerState $state, bool $wrapperUnmodified = false
20    ): ?Node {
21        $state->emitChunk( str_repeat( '-',
22            4 + ( DOMDataUtils::getDataParsoid( $node )->extra_dashes ?? 0 ) ), $node );
23        return $node->nextSibling;
24    }
25
26    /** @inheritDoc */
27    public function before( Element $node, Node $otherNode, SerializerState $state ): array {
28        return [ 'min' => 1, 'max' => 2 ];
29    }
30
31    // XXX: Add a newline by default if followed by new/modified content
32
33    /** @inheritDoc */
34    public function after( Element $node, Node $otherNode, SerializerState $state ): array {
35        return [ 'min' => 0, 'max' => 2 ];
36    }
37
38}