1 | <?php |
||
2 | |||
3 | namespace diecoding\toastr; |
||
4 | |||
5 | use Yii; |
||
6 | |||
7 | /** |
||
8 | * ToastrFlash is a widget integrating the [Toastr](https://codeseven.github.io/toastr/). |
||
9 | * |
||
10 | * @link [sugeng-sulistiyawan.github.io](sugeng-sulistiyawan.github.io) |
||
11 | * @author Sugeng Sulistiyawan <[email protected]> |
||
12 | * @copyright Copyright (c) 2023 |
||
13 | */ |
||
14 | class ToastrFlash extends ToastrBase |
||
15 | { |
||
16 | /** |
||
17 | * @inheritdoc |
||
18 | */ |
||
19 | public function run() |
||
20 | { |
||
21 | $session = Yii::$app->session; |
||
22 | $flashes = $session->getAllFlashes(); |
||
0 ignored issues
–
show
|
|||
23 | foreach ($flashes as $type => $data) { |
||
24 | $datas = (array) $data; |
||
25 | if (is_array($datas[0])) { |
||
26 | foreach ($datas as $value) { |
||
27 | $this->generateToastr($type, $value[1], $value[0]); |
||
28 | } |
||
29 | } else { |
||
30 | foreach ($datas as $value) { |
||
31 | $this->generateToastr($type, $value); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | $session->removeFlash($type); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Generate Single Toastr |
||
41 | * |
||
42 | * @param string $type |
||
43 | * @param string $message |
||
44 | * @param string|null $title |
||
45 | * @return void |
||
46 | */ |
||
47 | private function generateToastr($type, $message, $title = null) |
||
48 | { |
||
49 | Toastr::widget([ |
||
50 | "type" => $type, |
||
51 | "title" => $title, |
||
52 | "message" => $message, |
||
53 | "options" => $this->options, |
||
54 | ]); |
||
55 | } |
||
56 | } |
||
57 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.