ThemeToggle   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A __construct() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xetaravel\View\Components;
6
7
use Closure;
8
use Illuminate\Contracts\View\View;
9
use Illuminate\View\Component;
10
11
class ThemeToggle extends Component
12
{
13
    public string $uuid;
14
15
    public function __construct(
16
        public ?string $id = null,
17
        public ?string $value = null,
18
        public ?string $light = "Light",
19
        public ?string $dark = "Dark",
20
        public ?string $lightTheme = "light",
21
        public ?string $darkTheme = "dark",
22
        public ?string $lightClass = "light",
23
        public ?string $darkClass = "dark",
24
        public ?bool $withLabel = false,
25
    ) {
26
        $this->uuid = md5(serialize($this)) . $id;
27
    }
28
29
    /**
30
     * Get the view / contents that represent the component.
31
     */
32
    public function render(): View|Closure|string
33
    {
34
        return view('components.theme-toggle');
35
    }
36
}
37