1 | <?php |
||||
2 | |||||
3 | namespace Jidaikobo\Kontiki\Handlers; |
||||
4 | |||||
5 | use Jidaikobo\Kontiki\Models\ModelInterface; |
||||
6 | use Jidaikobo\Kontiki\Utils\MessageUtils; |
||||
7 | |||||
8 | class TableHandler |
||||
9 | { |
||||
10 | private ?ModelInterface $model = null; |
||||
11 | private string $tableHtml = ''; |
||||
12 | |||||
13 | public function setModel(ModelInterface $model): void |
||||
14 | { |
||||
15 | $this->model = $model; |
||||
16 | } |
||||
17 | public function setHtml(string $html): void |
||||
18 | { |
||||
19 | $this->tableHtml = $html; |
||||
20 | } |
||||
21 | |||||
22 | public function addErrors(array $errors): void |
||||
23 | { |
||||
24 | if (empty($errors)) { |
||||
25 | return; |
||||
26 | } |
||||
27 | $this->tableHtml = MessageUtils::errorHtml($errors, $this->model) . $this->tableHtml; |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
28 | } |
||||
29 | |||||
30 | public function addSuccessMessages(array $successMessages): void |
||||
31 | { |
||||
32 | if (empty($successMessages)) { |
||||
33 | return; |
||||
34 | } |
||||
35 | $successMessage = join($successMessages); |
||||
0 ignored issues
–
show
The call to
join() has too few arguments starting with array .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
36 | $this->tableHtml = MessageUtils::alertHtml($successMessage) . $this->tableHtml; |
||||
37 | } |
||||
38 | |||||
39 | public function getHtml(): string |
||||
40 | { |
||||
41 | return $this->tableHtml; |
||||
42 | } |
||||
43 | } |
||||
44 |