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