Total Complexity | 4 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | class SimpleShortcode implements Contracts\AttributeInterface, Contracts\AliasInterface, Contracts\ContainerAwareInterface |
||
13 | { |
||
14 | use Traits\Attribute, Traits\Alias, Traits\ContainerAware; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $name; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $attributes; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $alias = []; |
||
30 | |||
31 | /** |
||
32 | * @var Closure|null |
||
33 | */ |
||
34 | protected $callback; |
||
35 | |||
36 | /** |
||
37 | * @param string $name |
||
38 | * @param array|null $atts |
||
39 | * @param Closure|null $callback |
||
40 | */ |
||
41 | 18 | public function __construct($name, $atts = [], Closure $callback = null) |
|
42 | { |
||
43 | 18 | $this->name = $name; |
|
44 | 18 | $this->attributes = (array) $atts; |
|
45 | 18 | $this->callback = $callback; |
|
46 | 18 | } |
|
47 | |||
48 | /** |
||
49 | * @param string|null $content |
||
50 | * @param array $atts |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | 1 | public function handle(?string $content = null, array $atts = []): string |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * @param string $string |
||
66 | * |
||
67 | * @return Contracts\AliasInterface |
||
68 | * |
||
69 | * @throws \Maiorano\Shortcodes\Exceptions\RegisterException |
||
70 | */ |
||
71 | 1 | public function alias(string $string): Contracts\AliasInterface |
|
77 |