TagDTO::getNode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PHPHtmlParser\DTO;
6
7
use PHPHtmlParser\Dom\Node\HtmlNode;
8
9
final class TagDTO
10
{
11
    /**
12
     * @var bool
13
     */
14
    private $status;
15
16
    /**
17
     * @var bool
18
     */
19
    private $closing;
20
21
    /**
22
     * @var ?HtmlNode
23
     */
24
    private $node;
25
26
    /**
27
     * @var ?string
28
     */
29
    private $tag;
30
31 294
    private function __construct(array $values = [])
32
    {
33 294
        $this->status = $values['status'] ?? false;
34 294
        $this->closing = $values['closing'] ?? false;
35 294
        $this->node = $values['node'] ?? null;
36 294
        $this->tag = $values['tag'] ?? null;
37 294
    }
38
39 294
    public static function makeFromPrimitives(bool $status = false, bool $closing = false, ?HtmlNode $node = null, ?string $tag = null): TagDTO
40
    {
41 294
        return new TagDTO([
42 294
            'status'  => $status,
43 294
            'closing' => $closing,
44 294
            'node'    => $node,
45 294
            'tag'     => $tag,
46
        ]);
47
    }
48
49 294
    public function isStatus(): bool
50
    {
51 294
        return $this->status;
52
    }
53
54 288
    public function isClosing(): bool
55
    {
56 288
        return $this->closing;
57
    }
58
59
    /**
60
     * @return mixed
61
     */
62 288
    public function getNode(): ?HtmlNode
63
    {
64 288
        return $this->node;
65
    }
66
67
    /**
68
     * @return mixed
69
     */
70 255
    public function getTag(): ?string
71
    {
72 255
        return $this->tag;
73
    }
74
}
75