Element   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A withTag() 0 10 1
1
<?php
2
3
namespace Spatie\Html\Elements;
4
5
use ReflectionClass;
6
use Spatie\Html\Attributes;
7
use Spatie\Html\BaseElement;
8
use Illuminate\Support\Collection;
9
10
class Element extends BaseElement
11
{
12
    /**
13
     * @param string $tag
14
     *
15
     * @return static
16
     */
17
    public static function withTag($tag)
18
    {
19
        $element = (new ReflectionClass(static::class))->newInstanceWithoutConstructor();
20
21
        $element->tag = $tag;
22
        $element->attributes = new Attributes();
23
        $element->children = new Collection();
24
25
        return $element;
26
    }
27
}
28