@@ -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); |
@@ -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,6 +111,10 @@ 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); |
@@ -108,6 +122,9 @@ discard block |
||
108 | 122 | return $this; |
109 | 123 | } |
110 | 124 | |
125 | + /** |
|
126 | + * @param EventHandler\FilterRawEventHandler $handler |
|
127 | + */ |
|
111 | 128 | public function addEventHandler($name, $handler) |
112 | 129 | { |
113 | 130 | $this->events->addListener($name, $handler); |
@@ -117,6 +134,9 @@ discard block |
||
117 | 134 | |
118 | 135 | /* --- SERIALIZATION --------------------------------------------------- */ |
119 | 136 | |
137 | + /** |
|
138 | + * @param string $format |
|
139 | + */ |
|
120 | 140 | public function serialize(ShortcodeInterface $shortcode, $format) |
121 | 141 | { |
122 | 142 | switch($format) { |
@@ -128,6 +148,9 @@ discard block |
||
128 | 148 | } |
129 | 149 | } |
130 | 150 | |
151 | + /** |
|
152 | + * @param string $format |
|
153 | + */ |
|
131 | 154 | public function unserialize($text, $format) |
132 | 155 | { |
133 | 156 | switch($format) { |
@@ -127,6 +127,9 @@ discard block |
||
127 | 127 | return $text; |
128 | 128 | } |
129 | 129 | |
130 | + /** |
|
131 | + * @param callable|null $handler |
|
132 | + */ |
|
130 | 133 | private function processHandler(ParsedShortcodeInterface $parsed, ProcessorContext $context, $handler) |
131 | 134 | { |
132 | 135 | $processed = ProcessedShortcode::createFromContext(clone $context); |
@@ -144,6 +147,9 @@ discard block |
||
144 | 147 | return mb_substr($state, 0, $offset, 'utf-8').$processed->getContent().mb_substr($state, $offset + $length, mb_strlen($state, 'utf-8'), 'utf-8'); |
145 | 148 | } |
146 | 149 | |
150 | + /** |
|
151 | + * @return string |
|
152 | + */ |
|
147 | 153 | private function processRecursion(ParsedShortcodeInterface $shortcode, ProcessorContext $context) |
148 | 154 | { |
149 | 155 | if ($this->autoProcessContent && null !== $shortcode->getContent()) { |
@@ -73,6 +73,11 @@ discard block |
||
73 | 73 | return $shortcodes; |
74 | 74 | } |
75 | 75 | |
76 | + /** |
|
77 | + * @param string|null $bbCode |
|
78 | + * @param null|string $content |
|
79 | + * @param string $text |
|
80 | + */ |
|
76 | 81 | private function getObject($name, $parameters, $bbCode, $offset, $content, $text) |
77 | 82 | { |
78 | 83 | return new ParsedShortcode(new Shortcode($name, $parameters, $content, $bbCode), $text, $offset); |
@@ -254,11 +259,18 @@ discard block |
||
254 | 259 | return $backtrack; |
255 | 260 | } |
256 | 261 | |
262 | + /** |
|
263 | + * @param integer $type |
|
264 | + */ |
|
257 | 265 | private function lookahead($type) |
258 | 266 | { |
259 | 267 | return $this->position < $this->tokensCount && $this->tokens[$this->position][0] === $type; |
260 | 268 | } |
261 | 269 | |
270 | + /** |
|
271 | + * @param null|integer $type |
|
272 | + * @param boolean $ws |
|
273 | + */ |
|
262 | 274 | private function match($type, $ws) |
263 | 275 | { |
264 | 276 | if($this->position >= $this->tokensCount) { |
@@ -280,6 +292,9 @@ discard block |
||
280 | 292 | |
281 | 293 | /* --- LEXER ----------------------------------------------------------- */ |
282 | 294 | |
295 | + /** |
|
296 | + * @param string $text |
|
297 | + */ |
|
283 | 298 | private function tokenize($text) |
284 | 299 | { |
285 | 300 | $count = preg_match_all($this->lexerRegex, $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); |