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