Passed
Push — master ( bead09...1fb040 )
by Satoshi
02:15
created

DepsInternal::getFqsen()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace DependencyAnalyzer\DependencyGraph\ExtraPhpDocTags;
5
6
use DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName;
7
use DependencyAnalyzer\DependencyGraph\FullyQualifiedStructuralElementName\Base as FQSEN;
8
use DependencyAnalyzer\Exceptions\InvalidFullyQualifiedStructureElementNameException;
9
10
class DepsInternal
11
{
12
    const TAG_NAME = '@deps-internal';
13
14
    /**
15
     * @var FQSEN
16
     */
17
    protected $fqsen;
18
19
    /**
20
     * @var array
21
     */
22
    protected $options;
23
24
    /**
25
     * @var FQSEN[]
26
     */
27
    protected $targets = [];
28
29
    /**
30
     * @param FQSEN $fqsen
31
     * @param string[] $options
32
     * @deps-internal \DependencyAnalyzer\DependencyGraphBuilder\ExtraPhpDocTagResolver
33
     */
34
    public function __construct(FQSEN $fqsen, array $options = [])
35
    {
36
        $this->fqsen = $fqsen;
37
        $this->options = $options;
38
39
        try {
40
            foreach ($this->options as $option) {
41
                $this->targets[] = FullyQualifiedStructuralElementName::createFromString($option);
42
            }
43
        } catch (InvalidFullyQualifiedStructureElementNameException $e) {
44
            throw $e;
45
        }
46
    }
47
48
    public function getFqsen(): FQSEN
49
    {
50
        return $this->fqsen;
51
    }
52
53
    /**
54
     * @return FQSEN[]
55
     */
56
    public function getTargets(): array
57
    {
58
        return $this->targets;
59
    }
60
61
    public function getTargetsAsString(): array
62
    {
63
        return $this->options;
64
    }
65
}
66