@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class English extends LanguageBase implements LanguageInterface{ |
|
18 | +class English extends LanguageBase implements LanguageInterface { |
|
19 | 19 | |
20 | 20 | public $parserExceptionCallback = 'preg_replace_callback() died on [%1$s] due to a %2$s (%3$s)'; |
21 | 21 | public $parserExceptionMatchall = 'preg_match_all() died due to a %1$s (%2$s)'; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class French extends LanguageBase implements LanguageInterface{ |
|
18 | +class French extends LanguageBase implements LanguageInterface { |
|
19 | 19 | |
20 | 20 | public $parserExceptionCallback = ''; |
21 | 21 | public $parserExceptionMatchall = ''; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class German extends LanguageBase implements LanguageInterface{ |
|
18 | +class German extends LanguageBase implements LanguageInterface { |
|
19 | 19 | |
20 | 20 | public $parserExceptionCallback = 'preg_replace_callback() verursachte einen %2$s (%3$s) am tag [%1$s]'; |
21 | 21 | public $parserExceptionMatchall = 'preg_match_all() verursachte einen %1$s (%2$s)'; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @method string expanderDisplaySpoiler($override_language = null) |
35 | 35 | * @method string expanderDisplayTrigger($override_language = null) |
36 | 36 | */ |
37 | -class LanguageBase{ |
|
37 | +class LanguageBase { |
|
38 | 38 | use ClassLoaderTrait; |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return mixed |
47 | 47 | */ |
48 | - public function __call($name, $arguments){ |
|
48 | + public function __call($name, $arguments) { |
|
49 | 49 | return $this->string($name, ...$arguments); |
50 | 50 | } |
51 | 51 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @return mixed |
59 | 59 | * @throws \chillerlan\bbcode\BBCodeException |
60 | 60 | */ |
61 | - public function string($key, $override_language = null){ |
|
61 | + public function string($key, $override_language = null) { |
|
62 | 62 | |
63 | - if($override_language){ |
|
63 | + if ($override_language) { |
|
64 | 64 | return $this->__loadClass($override_language, LanguageInterface::class)->{$key}(); |
65 | 65 | } |
66 | 66 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @method string expanderDisplayTrigger($override_language = null) |
35 | 35 | * |
36 | 36 | */ |
37 | -interface LanguageInterface{ |
|
37 | +interface LanguageInterface { |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * It's magic. |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class Spanish extends LanguageBase implements LanguageInterface{ |
|
18 | +class Spanish extends LanguageBase implements LanguageInterface { |
|
19 | 19 | |
20 | 20 | public $parserExceptionCallback = ''; |
21 | 21 | public $parserExceptionMatchall = ''; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * The base module implements the basic functionality for each module |
20 | 20 | */ |
21 | -class BaseModule implements BaseModuleInterface{ |
|
21 | +class BaseModule implements BaseModuleInterface { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * The current bbcode tag |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param \chillerlan\bbcode\BBTemp $bbtemp |
116 | 116 | */ |
117 | - public function __construct(BBTemp $bbtemp = null){ |
|
118 | - if($bbtemp instanceof BBTemp){ |
|
117 | + public function __construct(BBTemp $bbtemp = null) { |
|
118 | + if ($bbtemp instanceof BBTemp) { |
|
119 | 119 | $this->setBBTemp($bbtemp); |
120 | 120 | } |
121 | 121 | } |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return $this |
129 | 129 | */ |
130 | - public function setBBTemp(BBTemp $bbtemp){ |
|
131 | - foreach(['tag', 'attributes', 'content', 'parserOptions', 'languageInterface', 'depth'] as $var){ |
|
130 | + public function setBBTemp(BBTemp $bbtemp) { |
|
131 | + foreach (['tag', 'attributes', 'content', 'parserOptions', 'languageInterface', 'depth'] as $var) { |
|
132 | 132 | $this->{$var} = $bbtemp->{$var}; |
133 | 133 | } |
134 | 134 | |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return \chillerlan\bbcode\Modules\BaseModuleInfo |
142 | 142 | */ |
143 | - public function getInfo(){ |
|
143 | + public function getInfo() { |
|
144 | 144 | $info = new BaseModuleInfo; |
145 | 145 | |
146 | - foreach(['modules', 'eol_token'] as $option){ |
|
146 | + foreach (['modules', 'eol_token'] as $option) { |
|
147 | 147 | $info->{$option} = $this->{$option}; |
148 | 148 | } |
149 | 149 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @return \chillerlan\bbcode\Modules\Tagmap |
157 | 157 | * @see \chillerlan\bbcode\Modules\ModuleInterface |
158 | 158 | */ |
159 | - public function getTags(){ |
|
159 | + public function getTags() { |
|
160 | 160 | $tags = new Tagmap; |
161 | 161 | $tags->tags = $this->tags; |
162 | 162 | $tags->noparse_tags = $this->noparse_tags; |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @return $this |
172 | 172 | * @throws \chillerlan\bbcode\BBCodeException |
173 | 173 | */ |
174 | - public function checkTag(){ |
|
175 | - if(!$this->tag || !in_array($this->tag, $this->tags)){ |
|
174 | + public function checkTag() { |
|
175 | + if (!$this->tag || !in_array($this->tag, $this->tags)) { |
|
176 | 176 | throw new BBCodeException('tag ['.$this->tag.'] not supported.'); |
177 | 177 | } |
178 | 178 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return string |
190 | 190 | */ |
191 | - public function eol($str, $eol = '', $count = null){ |
|
191 | + public function eol($str, $eol = '', $count = null) { |
|
192 | 192 | return str_replace($this->parserOptions->eol_placeholder, $eol, $str, $count); |
193 | 193 | } |
194 | 194 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return $this |
201 | 201 | */ |
202 | - public function clearEOL($eol = null){ |
|
202 | + public function clearEOL($eol = null) { |
|
203 | 203 | $eol = $eol ?: $this->eol_token; |
204 | 204 | $this->content = str_replace($this->parserOptions->eol_placeholder, $eol, $this->content); |
205 | 205 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @return $this |
213 | 213 | */ |
214 | - public function clearPseudoClosingTags(){ |
|
214 | + public function clearPseudoClosingTags() { |
|
215 | 215 | $this->content = preg_replace('#\[/('.$this->parserOptions->singletags.')]#is', '', $this->content); |
216 | 216 | |
217 | 217 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @return mixed the attribute's value in case it exists, otherwise $default |
227 | 227 | */ |
228 | - public function getAttribute($name, $default = false){ |
|
228 | + public function getAttribute($name, $default = false) { |
|
229 | 229 | return isset($this->attributes[$name]) && !empty($this->attributes[$name]) ? $this->attributes[$name] : $default; |
230 | 230 | } |
231 | 231 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return mixed boolean if no $default is set, otherwise the attribute's value in case it exists and is whitelisted or $default |
240 | 240 | */ |
241 | - public function attributeIn($name, array $whitelist, $default = false){ |
|
241 | + public function attributeIn($name, array $whitelist, $default = false) { |
|
242 | 242 | return isset($this->attributes[$name]) && in_array($this->attributes[$name], $whitelist) |
243 | 243 | ? $default !== false ? $this->attributes[$name] : true |
244 | 244 | : $default; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return mixed boolean if no $default is set, otherwise the whitelist value to the given key in case it exists or $default |
255 | 255 | */ |
256 | - public function attributeKeyIn($name, array $whitelist, $default = false){ |
|
256 | + public function attributeKeyIn($name, array $whitelist, $default = false) { |
|
257 | 257 | return isset($this->attributes[$name]) && array_key_exists($this->attributes[$name], $whitelist) |
258 | 258 | ? $default !== false ? $whitelist[$this->attributes[$name]] : true |
259 | 259 | : $default; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return mixed boolean if no $default is set, otherwise the whitelisted tag or $default |
269 | 269 | */ |
270 | - public function tagIn(array $whitelist, $default = false){ |
|
270 | + public function tagIn(array $whitelist, $default = false) { |
|
271 | 271 | return in_array($this->tag, $whitelist) |
272 | 272 | ? $default !== false ? $this->tag : true |
273 | 273 | : $default; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return string |
282 | 282 | * @codeCoverageIgnore |
283 | 283 | */ |
284 | - public function sanitize($content){ |
|
284 | + public function sanitize($content) { |
|
285 | 285 | return 'Implement sanitize() method!'; |
286 | 286 | } |
287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @see \chillerlan\bbcode\Modules\ModuleInterface::transform() |
294 | 294 | */ |
295 | - public function transform(){ |
|
295 | + public function transform() { |
|
296 | 296 | $this->checkTag(); |
297 | 297 | |
298 | 298 | /** @var $this \chillerlan\bbcode\Modules\ModuleInterface */ |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return mixed $this->attributes['__BBTAG__'] |
308 | 308 | */ |
309 | - protected function bbtag($default = false){ |
|
309 | + protected function bbtag($default = false) { |
|
310 | 310 | return $this->getAttribute($this->parserOptions->bbtag_placeholder, $default); |
311 | 311 | } |
312 | 312 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * |
319 | 319 | * @return mixed |
320 | 320 | */ |
321 | - protected function bbtagIn(array $array, $default = false){ |
|
321 | + protected function bbtagIn(array $array, $default = false) { |
|
322 | 322 | return $this->attributeIn($this->parserOptions->bbtag_placeholder, $array, $default); |
323 | 323 | } |
324 | 324 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return bool|string the url if valid, otherwise false |
331 | 331 | */ |
332 | - public function checkUrl($url){ |
|
333 | - if(filter_var($url, FILTER_VALIDATE_URL) === false){ |
|
332 | + public function checkUrl($url) { |
|
333 | + if (filter_var($url, FILTER_VALIDATE_URL) === false) { |
|
334 | 334 | return false; |
335 | 335 | } |
336 | 336 | // todo: check against whitelist? |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return string |
348 | 348 | */ |
349 | - public function wrap($content, $wrapper){ |
|
349 | + public function wrap($content, $wrapper) { |
|
350 | 350 | return $wrapper.$content.$wrapper; |
351 | 351 | } |
352 | 352 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * |
18 | 18 | * @see \chillerlan\bbcode\Modules\BaseModule::getInfo() |
19 | 19 | */ |
20 | -class BaseModuleInfo{ |
|
20 | +class BaseModuleInfo { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Holds an array of FQN strings to the current base module's children |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * Implements the basic functionality for each module |
19 | 19 | */ |
20 | -interface BaseModuleInterface{ |
|
20 | +interface BaseModuleInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Sets self::$tag, self::$attributes, self::$content and self::$options |