GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Tag   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 42
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A make() 0 4 1
A withContents() 0 8 2
A open() 0 8 2
A close() 0 4 1
1
<?php
2
3
namespace Spatie\Menu\Html;
4
5
class Tag
6
{
7
    /** @var string */
8
    protected $tagName;
9
10
    /** @var \Spatie\Menu\Html\Attributes */
11
    protected $attributes;
12
13
    public function __construct(string $tagName, Attributes $attributes = null)
14
    {
15
        $this->tagName = $tagName;
16
        $this->attributes = $attributes ?: new Attributes();
17
    }
18
19
    public static function make(string $tagName, Attributes $attributes = null)
20
    {
21
        return new self($tagName, $attributes);
22
    }
23
24
    public function withContents($contents): string
25
    {
26
        if (is_array($contents)) {
27
            $contents = implode('', $contents);
28
        }
29
30
        return $this->open().$contents.$this->close();
31
    }
32
33
    public function open(): string
34
    {
35
        if ($this->attributes->isEmpty()) {
36
            return "<{$this->tagName}>";
37
        }
38
39
        return "<{$this->tagName} {$this->attributes}>";
40
    }
41
42
    public function close(): string
43
    {
44
        return "</{$this->tagName}>";
45
    }
46
}
47