ClassLike::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace DependencyAnalyzer\DependencyGraph;
5
6
use DependencyAnalyzer\DependencyGraph\ExtraPhpDocTags\DepsInternal;
7
use DependencyAnalyzer\DependencyGraph\ExtraPhpDocTags\Internal;
8
use Fhaculty\Graph\Vertex;
9
10
class ClassLike
11
{
12
    /**
13
     * @var Vertex
14
     */
15
    private $vertex;
16
17
    public function __construct(Vertex $vertex)
18
    {
19
        $this->vertex = $vertex;
20
    }
21
22
    public function getVertex(): Vertex
23
    {
24
        return $this->vertex;
25
    }
26
27
    public function getName(): string
28
    {
29
        return $this->vertex->getId();
30
    }
31
32
    /**
33
     * @return DepsInternal[]
34
     */
35
    public function getDepsInternalTag(): array
36
    {
37
        return $this->vertex->getAttribute(DepsInternal::getTagName());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->vertex->ge...Internal::getTagName()) could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
38
    }
39
40
    /**
41
     * @return Internal[]
42
     */
43
    public function getInternalTag(): array
44
    {
45
        return $this->vertex->getAttribute(Internal::getTagName());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->vertex->ge...Internal::getTagName()) could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
46
    }
47
48
    public function __toString(): string
49
    {
50
        return $this->getName();
51
    }
52
}
53