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