1 | <?php |
||
8 | class Content implements Renderable |
||
9 | { |
||
10 | /** |
||
11 | * Content header. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $header = ''; |
||
16 | |||
17 | /** |
||
18 | * Content description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = ''; |
||
23 | |||
24 | /** |
||
25 | * Page breadcrumb. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $breadcrumb = []; |
||
30 | |||
31 | /** |
||
32 | * @var Row[] |
||
33 | */ |
||
34 | protected $rows = []; |
||
35 | |||
36 | /** |
||
37 | * Content constructor. |
||
38 | * |
||
39 | * @param Closure|null $callback |
||
40 | */ |
||
41 | public function __construct(\Closure $callback = null) |
||
47 | |||
48 | /** |
||
49 | * Set header of content. |
||
50 | * |
||
51 | * @param string $header |
||
52 | * |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function header($header = '') |
||
61 | |||
62 | /** |
||
63 | * Set description of content. |
||
64 | * |
||
65 | * @param string $description |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function description($description = '') |
||
75 | |||
76 | /** |
||
77 | * Set breadcrumb of content. |
||
78 | * |
||
79 | * @param array ...$breadcrumb |
||
80 | * |
||
81 | * @return $this |
||
82 | */ |
||
83 | public function breadcrumb(...$breadcrumb) |
||
91 | |||
92 | /** |
||
93 | * Validate content breadcrumb. |
||
94 | * |
||
95 | * @param array $breadcrumb |
||
96 | * |
||
97 | * @throws \Exception |
||
98 | * |
||
99 | * @return bool |
||
100 | */ |
||
101 | protected function validateBreadcrumb(array $breadcrumb) |
||
111 | |||
112 | /** |
||
113 | * Alias of method row. |
||
114 | * |
||
115 | * @param mixed $content |
||
116 | * |
||
117 | * @return Content |
||
118 | */ |
||
119 | public function body($content) |
||
123 | |||
124 | /** |
||
125 | * Add one row for content body. |
||
126 | * |
||
127 | * @param $content |
||
128 | * |
||
129 | * @return $this |
||
130 | */ |
||
131 | public function row($content) |
||
143 | |||
144 | /** |
||
145 | * Add Row. |
||
146 | * |
||
147 | * @param Row $row |
||
148 | */ |
||
149 | protected function addRow(Row $row) |
||
153 | |||
154 | /** |
||
155 | * Build html of content. |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | public function build() |
||
173 | |||
174 | /** |
||
175 | * Set success message for content. |
||
176 | * |
||
177 | * @param string $title |
||
178 | * @param string $message |
||
179 | * |
||
180 | * @return $this |
||
181 | */ |
||
182 | public function withSuccess($title = '', $message = '') |
||
188 | |||
189 | /** |
||
190 | * Set error message for content. |
||
191 | * |
||
192 | * @param string $title |
||
193 | * @param string $message |
||
194 | * |
||
195 | * @return $this |
||
196 | */ |
||
197 | public function withError($title = '', $message = '') |
||
203 | |||
204 | /** |
||
205 | * Set warning message for content. |
||
206 | * |
||
207 | * @param string $title |
||
208 | * @param string $message |
||
209 | * |
||
210 | * @return $this |
||
211 | */ |
||
212 | public function withWarning($title = '', $message = '') |
||
218 | |||
219 | /** |
||
220 | * Set info message for content. |
||
221 | * |
||
222 | * @param string $title |
||
223 | * @param string $message |
||
224 | * |
||
225 | * @return $this |
||
226 | */ |
||
227 | public function withInfo($title = '', $message = '') |
||
233 | |||
234 | /** |
||
235 | * Render this content. |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | public function render() |
||
250 | } |
||
251 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: