Total Complexity | 5 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 7 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
5 | trait SlotRenderer |
||
6 | { |
||
7 | protected $slotName; |
||
8 | |||
9 | protected $slots = []; |
||
10 | |||
11 | /** |
||
12 | * Start output buffer to get content of slot and set slot name |
||
13 | * |
||
14 | * @param String $name |
||
15 | */ |
||
16 | 5 | public function startSlot($name) |
|
17 | { |
||
18 | 5 | if (ob_start()) |
|
19 | 5 | $this->slotName = $name; |
|
20 | 5 | } |
|
21 | |||
22 | /** |
||
23 | * get slot content from widget block |
||
24 | * |
||
25 | * @param String $data |
||
26 | */ |
||
27 | 5 | public function renderSlot($data = "") |
|
30 | 5 | } |
|
31 | |||
32 | /** |
||
33 | * check if widget has any slots |
||
34 | * |
||
35 | * @return Boolean |
||
36 | */ |
||
37 | 21 | public function hasSlots() |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * get and clean current slots |
||
44 | * |
||
45 | * @return Array $slots |
||
46 | */ |
||
47 | 4 | public function getSlots() |
|
56 |