BreadcrumbItemComponent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A active() 0 11 3
1
<?php
2
3
namespace Lagdo\UiBuilder\Component\Base;
4
5
use Lagdo\UiBuilder\Component\HtmlComponent;
6
7
class BreadcrumbItemComponent extends HtmlComponent
8
{
9
    /**
10
     * @var string
11
     */
12
    public static string $tag = 'li';
13
14
    /**
15
     * @param bool $active
16
     *
17
     * @return static
18
     */
19
    public function active(bool $active = false): static
20
    {
21
        if ($active) {
22
            $this->element()->addClass('active');
23
            return $this;
24
        }
25
26
        if ($this->element()->hasClass('active')) {
27
            $this->element()->removeClass('active');
28
        }
29
        return $this;
30
    }
31
}
32