@@ -49,6 +49,9 @@ |
||
| 49 | 49 | return $shortcodes; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $text |
|
| 54 | + */ |
|
| 52 | 55 | private static function parseParameters($text) |
| 53 | 56 | { |
| 54 | 57 | $text = preg_replace('/[\x{00a0}\x{200b}]+/u', ' ', $text); |
@@ -57,6 +57,11 @@ discard block |
||
| 57 | 57 | return $shortcodes; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string|null $bbCode |
|
| 62 | + * @param null|string $content |
|
| 63 | + * @param string $text |
|
| 64 | + */ |
|
| 60 | 65 | private function getObject($name, $parameters, $bbCode, $offset, $content, $text) |
| 61 | 66 | { |
| 62 | 67 | return new ParsedShortcode(new Shortcode($name, $parameters, $content, $bbCode), $text, $offset); |
@@ -272,6 +277,9 @@ discard block |
||
| 272 | 277 | return true; |
| 273 | 278 | } |
| 274 | 279 | |
| 280 | + /** |
|
| 281 | + * @param \Closure $callbacks |
|
| 282 | + */ |
|
| 275 | 283 | private function match($type, $callbacks = null, $ws = false) |
| 276 | 284 | { |
| 277 | 285 | if($this->position >= $this->tokensCount) { |
@@ -299,6 +307,9 @@ discard block |
||
| 299 | 307 | |
| 300 | 308 | /* --- LEXER ----------------------------------------------------------- */ |
| 301 | 309 | |
| 310 | + /** |
|
| 311 | + * @param string $text |
|
| 312 | + */ |
|
| 302 | 313 | private function tokenize($text) |
| 303 | 314 | { |
| 304 | 315 | preg_match_all($this->lexerRegex, $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); |
@@ -121,6 +121,9 @@ |
||
| 121 | 121 | $context->textContent = $shortcode->getContent(); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** |
|
| 125 | + * @param callable|null $handler |
|
| 126 | + */ |
|
| 124 | 127 | private function processHandler(ParsedShortcodeInterface $parsed, ProcessorContext $context, $handler) |
| 125 | 128 | { |
| 126 | 129 | $processed = ProcessedShortcode::createFromContext(clone $context); |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use Thunder\Shortcode\Shortcode\ReplacedShortcode; |
| 11 | 11 | use Thunder\Shortcode\Shortcode\ParsedShortcodeInterface; |
| 12 | 12 | use Thunder\Shortcode\Shortcode\ProcessedShortcode; |
| 13 | -use Thunder\Shortcode\Shortcode\ShortcodeInterface; |
|
| 14 | 13 | |
| 15 | 14 | /** |
| 16 | 15 | * @author Tomasz Kowalczyk <[email protected]> |
@@ -25,6 +25,9 @@ |
||
| 25 | 25 | return $this->replacement; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @return string |
|
| 30 | + */ |
|
| 28 | 31 | public function getText() |
| 29 | 32 | { |
| 30 | 33 | return $this->text; |
@@ -76,11 +76,17 @@ discard block |
||
| 76 | 76 | $this->processor = $this->processor->withEventContainer($this->events); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $text |
|
| 81 | + */ |
|
| 79 | 82 | public function process($text) |
| 80 | 83 | { |
| 81 | 84 | return $this->processor->process($text); |
| 82 | 85 | } |
| 83 | 86 | |
| 87 | + /** |
|
| 88 | + * @param string $text |
|
| 89 | + */ |
|
| 84 | 90 | public function parse($text) |
| 85 | 91 | { |
| 86 | 92 | return $this->parser->parse($text); |
@@ -94,6 +100,10 @@ discard block |
||
| 94 | 100 | return $this; |
| 95 | 101 | } |
| 96 | 102 | |
| 103 | + /** |
|
| 104 | + * @param string $name |
|
| 105 | + * @param \Closure $handler |
|
| 106 | + */ |
|
| 97 | 107 | public function addHandler($name, $handler) |
| 98 | 108 | { |
| 99 | 109 | $this->handlers->add($name, $handler); |
@@ -101,11 +111,18 @@ discard block |
||
| 101 | 111 | return $this; |
| 102 | 112 | } |
| 103 | 113 | |
| 114 | + /** |
|
| 115 | + * @param string $alias |
|
| 116 | + * @param string $name |
|
| 117 | + */ |
|
| 104 | 118 | public function addHandlerAlias($alias, $name) |
| 105 | 119 | { |
| 106 | 120 | $this->handlers->addAlias($alias, $name); |
| 107 | 121 | } |
| 108 | 122 | |
| 123 | + /** |
|
| 124 | + * @param EventHandler\FilterRawEventHandler $handler |
|
| 125 | + */ |
|
| 109 | 126 | public function addEventHandler($name, $handler) |
| 110 | 127 | { |
| 111 | 128 | $this->events->addListener($name, $handler); |
@@ -113,6 +130,9 @@ discard block |
||
| 113 | 130 | return $this; |
| 114 | 131 | } |
| 115 | 132 | |
| 133 | + /** |
|
| 134 | + * @param string $format |
|
| 135 | + */ |
|
| 116 | 136 | public function serialize(ShortcodeInterface $shortcode, $format) |
| 117 | 137 | { |
| 118 | 138 | switch($format) { |
@@ -124,6 +144,9 @@ discard block |
||
| 124 | 144 | } |
| 125 | 145 | } |
| 126 | 146 | |
| 147 | + /** |
|
| 148 | + * @param string $format |
|
| 149 | + */ |
|
| 127 | 150 | public function unserialize($text, $format) |
| 128 | 151 | { |
| 129 | 152 | switch($format) { |