@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public function __construct($name, $atts = [], Closure $callback = null) |
| 42 | 42 | { |
| 43 | 43 | $this->name = $name; |
| 44 | - $this->attributes = (array) $atts; |
|
| 44 | + $this->attributes = (array)$atts; |
|
| 45 | 45 | $this->callback = $callback; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function handle(?string $content = null, array $atts = []): string |
| 55 | 55 | { |
| 56 | 56 | if (is_null($this->callback)) { |
| 57 | - return (string) $content; |
|
| 57 | + return (string)$content; |
|
| 58 | 58 | } |
| 59 | 59 | $callback = $this->callback->bindTo($this, $this); |
| 60 | 60 | |
@@ -56,28 +56,28 @@ |
||
| 56 | 56 | private function calculate($units, DateInterval $diff) |
| 57 | 57 | { |
| 58 | 58 | $calculator = [ |
| 59 | - 'centuries' => function (DateInterval $diff) { |
|
| 59 | + 'centuries' => function(DateInterval $diff) { |
|
| 60 | 60 | return $diff->y / 100; |
| 61 | 61 | }, |
| 62 | - 'decades' => function (DateInterval $diff) { |
|
| 62 | + 'decades' => function(DateInterval $diff) { |
|
| 63 | 63 | return $diff->y / 10; |
| 64 | 64 | }, |
| 65 | - 'years' => function (DateInterval $diff) { |
|
| 65 | + 'years' => function(DateInterval $diff) { |
|
| 66 | 66 | return $diff->y; |
| 67 | 67 | }, |
| 68 | - 'months' => function (DateInterval $diff) { |
|
| 68 | + 'months' => function(DateInterval $diff) { |
|
| 69 | 69 | return $diff->y * 12 + $diff->m; |
| 70 | 70 | }, |
| 71 | - 'days' => function (DateInterval $diff) { |
|
| 71 | + 'days' => function(DateInterval $diff) { |
|
| 72 | 72 | return $diff->days; |
| 73 | 73 | }, |
| 74 | - 'hours' => function (DateInterval $diff) { |
|
| 74 | + 'hours' => function(DateInterval $diff) { |
|
| 75 | 75 | return ($diff->days * 24) + $diff->h; |
| 76 | 76 | }, |
| 77 | - 'minutes' => function (DateInterval $diff) { |
|
| 77 | + 'minutes' => function(DateInterval $diff) { |
|
| 78 | 78 | return ($diff->days * 24 * 60) + $diff->i; |
| 79 | 79 | }, |
| 80 | - 'seconds' => function (DateInterval $diff) { |
|
| 80 | + 'seconds' => function(DateInterval $diff) { |
|
| 81 | 81 | return ($diff->days * 24 * 60 * 60) + $diff->s; |
| 82 | 82 | }, |
| 83 | 83 | ]; |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function handle(?string $content = null): string |
| 43 | 43 | { |
| 44 | - return trim((string) preg_replace('/\s+/', ' ', $this->ipsum)); |
|
| 44 | + return trim((string)preg_replace('/\s+/', ' ', $this->ipsum)); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * @const string |
| 19 | 19 | */ |
| 20 | - const NO_ALIAS = 'Cannot alias a shortcode that does not implement '.AliasInterface::class; |
|
| 20 | + const NO_ALIAS = 'Cannot alias a shortcode that does not implement ' . AliasInterface::class; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @return static |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | return iterator_to_array($this->generateResults($matches)); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - return preg_replace_callback("/$regex/", function ($match) use ($callback) { |
|
| 34 | + return preg_replace_callback("/$regex/", function($match) use ($callback) { |
|
| 35 | 35 | if ($match[1] == '[' && $match[6] == ']') { |
| 36 | 36 | return substr($match[0], 1, -1); |
| 37 | 37 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | .'\\[\\/\\2\\]' // Closing shortcode tag |
| 83 | 83 | .')?' |
| 84 | 84 | .')' |
| 85 | - .'(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]] |
|
| 85 | + .'(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]] |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ]); |
| 106 | 106 | $pattern = "/{$patterns}/"; |
| 107 | 107 | $text = preg_replace("/[\x{00a0}\x{200b}]+/u", ' ', $text); |
| 108 | - if (preg_match_all($pattern, (string) $text, $match, PREG_SET_ORDER)) { |
|
| 108 | + if (preg_match_all($pattern, (string)$text, $match, PREG_SET_ORDER)) { |
|
| 109 | 109 | |
| 110 | 110 | // Reject any unclosed HTML elements |
| 111 | 111 | foreach ($this->generateAttributes($match) as $att => $value) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public function doShortcode(string $content, $tags = [], bool $deep = false): string |
| 142 | 142 | { |
| 143 | 143 | $tags = $this->preProcessTags($tags); |
| 144 | - $handler = function (string $tag, ?string $content = null, array $atts = []) { |
|
| 144 | + $handler = function(string $tag, ?string $content = null, array $atts = []) { |
|
| 145 | 145 | $shortcode = $this[$tag]; |
| 146 | 146 | |
| 147 | 147 | if ($shortcode instanceof AttributeInterface) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | return $shortcode->handle($content); |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | - $result = (string) $this->parser->parseShortcode($content, $tags, $handler); |
|
| 156 | + $result = (string)$this->parser->parseShortcode($content, $tags, $handler); |
|
| 157 | 157 | |
| 158 | 158 | if ($deep && $this->hasShortcode($result, $tags)) { |
| 159 | 159 | return $this->doShortcode($result, $tags, $deep); |