Element::withTag()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
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