Passed
Push — master ( da3a15...020c57 )
by Satoshi
02:44
created

DepsInternal::getTargets()   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\ExtraPhpDocTagResolver;
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
    /**
13
     * @var FQSEN
14
     */
15
    protected $fqsen;
16
17
    /**
18
     * @var array
19
     */
20
    protected $options;
21
22
    /**
23
     * @var FQSEN[]
24
     */
25
    protected $targets = [];
26
27
    /**
28
     * DepsInternal constructor.
29
     * @param FQSEN $fqsen
30
     * @param string[] $options
31
     */
32
    public function __construct(FQSEN $fqsen, array $options = [])
33
    {
34
        $this->fqsen = $fqsen;
35
        $this->options = $options;
36
37
        try {
38
            foreach ($this->options as $option) {
39
                $this->targets[] = FullyQualifiedStructuralElementName::createFromString($option);
40
            }
41
        } catch (InvalidFullyQualifiedStructureElementNameException $e) {
42
            throw $e;
43
        }
44
    }
45
46
    public function getFqsen(): FQSEN
47
    {
48
        return $this->fqsen;
49
    }
50
51
    /**
52
     * @return FQSEN[]
53
     */
54
    public function getTargets(): array
55
    {
56
        return $this->targets;
57
    }
58
59
    public function getTargetsAsString(): array
60
    {
61
        return $this->options;
62
    }
63
}
64