AbstractMode.php 861 B

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