Header::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Support\Str;
10
use Illuminate\View\Component;
11
12
class Header extends Component
13
{
14
    public string $anchor = '';
15
16
    public function __construct(
17
        public ?string $title = null,
18
        public ?string $subtitle = null,
19
        public ?bool $separator = false,
20
        public ?string $progressIndicator = null,
21
        public ?bool $withAnchor = false,
22
        public ?string $size = 'text-2xl',
23
24
        // Slots
25
        public mixed $middle = null,
26
        public mixed $actions = null,
27
    ) {
28
        $this->anchor = Str::slug($title);
29
    }
30
31
    public function progressTarget(): ?string
32
    {
33
        if ($this->progressIndicator === 1) {
0 ignored issues
show
introduced by
The condition $this->progressIndicator === 1 is always false.
Loading history...
34
            return $this->attributes->whereStartsWith('progress-indicator')->first();
35
        }
36
37
        return $this->progressIndicator;
38
    }
39
40
    /**
41
     * Get the view / contents that represent the component.
42
     */
43
    public function render(): View|Closure|string
44
    {
45
        return view('components.header');
46
    }
47
}
48