Header   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A progressTarget() 0 7 2
A render() 0 3 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\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