1<?php
2
3namespace dokuwiki\Parsing\ParserMode;
4
5use dokuwiki\Parsing\Lexer\Lexer;
6
7/**
8 * This class and all the subclasses below are used to reduce the effort required to register
9 * modes with the Lexer.
10 *
11 * @author Harry Fuecks <hfuecks@gmail.com>
12 */
13abstract class AbstractMode implements ModeInterface
14{
15    /** @var Lexer $Lexer will be injected on loading FIXME this should be done by setter */
16    public $Lexer;
17    protected $allowedModes = [];
18
19    /** @inheritdoc */
20    abstract public function getSort();
21
22    /** @inheritdoc */
23    public function preConnect()
24    {
25    }
26
27    /** @inheritdoc */
28    public function connectTo($mode)
29    {
30    }
31
32    /** @inheritdoc */
33    public function postConnect()
34    {
35    }
36
37    /** @inheritdoc */
38    public function accepts($mode)
39    {
40        return in_array($mode, (array) $this->allowedModes);
41    }
42}
43