Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 19
CaptionHandler
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
42
0.00% covered (danger)
0.00%
0 / 19
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 handle
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 11
 before
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 4
 after
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
<?php
declare( strict_types = 1 );
namespace Wikimedia\Parsoid\Html2Wt\DOMHandlers;
use Wikimedia\Parsoid\DOM\Element;
use Wikimedia\Parsoid\DOM\Node;
use Wikimedia\Parsoid\Html2Wt\SerializerState;
use Wikimedia\Parsoid\Utils\DOMCompat;
use Wikimedia\Parsoid\Utils\DOMDataUtils;
class CaptionHandler extends DOMHandler {
    public function __construct() {
        parent::__construct( false );
    }
    /** @inheritDoc */
    public function handle(
        Element $node, SerializerState $state, bool $wrapperUnmodified = false
    ): ?Node {
        $dp = DOMDataUtils::getDataParsoid( $node );
        // Serialize the tag itself
        $tableTag = $this->serializeTableTag(
            $dp->startTagSrc ?? '|+', null, $state, $node,
            $wrapperUnmodified
        );
        $state->emitChunk( $tableTag, $node );
        $state->serializeChildren( $node );
        return $node->nextSibling;
    }
    /** @inheritDoc */
    public function before( Element $node, Node $otherNode, SerializerState $state ): array {
        return ( DOMCompat::nodeName( $otherNode ) !== 'table' )
            ? [ 'min' => 1, 'max' => $this->maxNLsInTable( $node, $otherNode ) ]
            : [ 'min' => 0, 'max' => $this->maxNLsInTable( $node, $otherNode ) ];
    }
    /** @inheritDoc */
    public function after( Element $node, Node $otherNode, SerializerState $state ): array {
        return [ 'min' => 1, 'max' => $this->maxNLsInTable( $node, $otherNode ) ];
    }
}