A fork of potaka/bbcode to handle future maintenance
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
817B

  1. <?php
  2. namespace Knockout\BbCode\Tag;
  3. use Knockout\BbCode\Tokenizer\Tag as TokenTag;
  4. /**
  5. * Description of UnknownSimpleType
  6. *
  7. * @author po_taka <angel.koilov@gmail.com>
  8. */
  9. class UnknownSimpleType implements TagInterface
  10. {
  11. public function format(TokenTag $tokenTag) : string
  12. {
  13. $formattedString = "[{$tokenTag->getType()}";
  14. if ($tokenTag->getArgument()) {
  15. $formattedString .= "={$tokenTag->getArgument()}";
  16. }
  17. $formattedString .= "]{$tokenTag->getText()}[/{$tokenTag->getType()}]";
  18. return $formattedString;
  19. }
  20. public function getName(): string
  21. {
  22. return '';
  23. }
  24. public function getOriginalText(TokenTag $tokenTag): string
  25. {
  26. return "[{$tokenTag->getType()}]{$tokenTag->getText()}[/{$tokenTag->getType()}]";
  27. }
  28. }