| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 28 | 3 | public function __invoke(ShortcodeInterface $shortcode) |
|
| 29 | { |
||
| 30 | 3 | $args = $shortcode->getParameters(); |
|
| 31 | 3 | if(empty($args)) { |
|
| 32 | 1 | return; |
|
| 33 | } |
||
| 34 | 2 | $keys = array_keys($args); |
|
| 35 | 2 | $name = array_shift($keys); |
|
| 36 | 2 | $content = $shortcode->getContent(); |
|
| 37 | 2 | $delimiter = $this->delimiter; |
|
| 38 | |||
| 39 | $this->handlers->add($name, function(ShortcodeInterface $shortcode) use($content, $delimiter) { |
||
| 40 | 1 | $args = $shortcode->getParameters(); |
|
| 41 | $keys = array_map(function($key) use($delimiter) { return $delimiter.$key.$delimiter; }, array_keys($args)); |
||
| 42 | 1 | $values = array_values($args); |
|
| 43 | |||
| 44 | 1 | return str_replace($keys, $values, $content); |
|
| 45 | 2 | }); |
|
| 46 | 2 | } |
|
| 47 | } |
||
| 48 |