WireToast::dehydrate()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 5
rs 10
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