| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Utils; |
| 5 |
|
| 6 |
use stdClass; |
| 7 |
use Wikimedia\Parsoid\Config\Env; |
| 8 |
use Wikimedia\Parsoid\Wt2Html\PegTokenizer; |
| 9 |
|
| 10 |
/** |
| 11 |
* State carried while DOM Traversing. |
| 12 |
* |
| 13 |
* FIXME: As it stands, DTState cannot be constructed outside of Parsoid. |
| 14 |
* However, extensions and core code might benefit from a non-Parsoid-specific |
| 15 |
* state object that DOMTraverser users outside of Parsoid could use. |
| 16 |
*/ |
| 17 |
class DTState { |
| 18 |
public Env $env; |
| 19 |
public array $options; |
| 20 |
public bool $atTopLevel; |
| 21 |
public ?stdClass $tplInfo = null; |
| 22 |
public array $abouts = []; |
| 23 |
public array $seenIds = []; |
| 24 |
public array $usedIdIndex = []; |
| 25 |
public ?PegTokenizer $tokenizer = null; // Needed by TableFixups handlers |
| 26 |
|
| 27 |
public function __construct( Env $env, array $options = [], bool $atTopLevel = false ) { |
| 28 |
$this->env = $env; |
| 29 |
$this->options = $options; |
| 30 |
$this->atTopLevel = $atTopLevel; |
| 31 |
} |
| 32 |
} |