WireToast   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 1
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A dehydrate() 0 5 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Usernotnull\Toast\Concerns;
6
7
use Usernotnull\Toast\ToastManager;
8
9
trait WireToast
10
{
11
    public function dehydrate(): void
12
    {
13
        if (! ToastManager::componentRendered()) {
14
            foreach (ToastManager::pull() ?? [] as $notification) {
15
                $this->dispatchBrowserEvent('toast', $notification);
16
            }
17
        }
18
    }
19
}
20