|
|
@@ -0,0 +1,25 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\BbCode\Tag; |
|
|
|
|
|
|
|
use Knockout\BbCode\Tag\TagInterface; |
|
|
|
use Knockout\BbCode\Tokenizer\Tag as TokenTag; |
|
|
|
|
|
|
|
class Code implements TagInterface |
|
|
|
{ |
|
|
|
|
|
|
|
public function format(TokenTag $tokenTag): string |
|
|
|
{ |
|
|
|
return sprintf('<pre>%s</pre>', htmlentities($tokenTag->getText())); |
|
|
|
} |
|
|
|
|
|
|
|
public function getName(): string |
|
|
|
{ |
|
|
|
return 'code'; |
|
|
|
} |
|
|
|
|
|
|
|
public function getOriginalText(TokenTag $tokenTag): string |
|
|
|
{ |
|
|
|
return "[{$this->getName()}]{$tokenTag->getText()}[/{$this->getName()}"; |
|
|
|
} |
|
|
|
} |