Total Complexity | 6 |
Total Lines | 75 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class Layout implements LayoutContract |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $body = self::BODY_DEFAULT; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $filters = array(); |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $helpers = array(); |
||
31 | |||
32 | /** |
||
33 | * @var string $body |
||
34 | */ |
||
35 | 27 | public function __construct($body = self::BODY_DEFAULT) |
|
36 | { |
||
37 | 27 | $this->body = $body; |
|
38 | 27 | } |
|
39 | |||
40 | /** |
||
41 | * Returns the body content of the layout if available. |
||
42 | * |
||
43 | * @return string |
||
44 | */ |
||
45 | 15 | public function body() |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * Adds a filter instance in the layout. |
||
52 | * |
||
53 | * @param \Staticka\Contracts\FilterContract $filter |
||
54 | * @return self |
||
55 | */ |
||
56 | 6 | public function filter(FilterContract $filter) |
|
57 | { |
||
58 | 6 | $this->filters[] = $filter; |
|
59 | 6 | } |
|
60 | |||
61 | /** |
||
62 | * Returns all available filters. |
||
63 | * |
||
64 | * @return \Staticka\Contracts\FilterContract[] |
||
65 | */ |
||
66 | 18 | public function filters() |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * Adds a helper instance in the layout. |
||
73 | * |
||
74 | * @param \Staticka\Contracts\HelperContract $helper |
||
75 | * @return self |
||
76 | */ |
||
77 | 6 | public function helper(HelperContract $helper) |
|
78 | { |
||
79 | 6 | $this->helpers[$helper->name()] = $helper; |
|
80 | 6 | } |
|
81 | |||
82 | /** |
||
83 | * Returns all available helpers. |
||
84 | * |
||
85 | * @return \Staticka\Contracts\HelperContract[] |
||
86 | */ |
||
87 | 18 | public function helpers() |
|
90 | } |
||
91 | } |
||
92 |