xref: /dokuwiki/_test/tests/Parsing/Lexer/RecordingHandler.php (revision 504c13e8df88563c11b3720b317991bc38835a35)
1<?php
2
3namespace dokuwiki\test\Parsing\Lexer;
4
5use dokuwiki\Parsing\Handler;
6
7/**
8 * Handler subclass that records all handleToken calls for later assertion
9 * instead of dispatching to mode objects.
10 */
11class RecordingHandler extends Handler
12{
13    /** @var array[] each entry is [method, match, state, pos] */
14    public array $recorded = [];
15
16    /** @inheritdoc */
17    public function handleToken($modeName, $match, $state, $pos, $originalModeName = '')
18    {
19        $this->recorded[] = [$modeName, $match, $state, $pos];
20        return true;
21    }
22}
23