Total Complexity | 9 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
18 | final class Scope |
||
19 | { |
||
20 | /** @var ReflectionClass|ReflectionProperty|ReflectionFunctionAbstract */ |
||
21 | private $subject; |
||
22 | |||
23 | /** @var Imports */ |
||
24 | private $imports; |
||
25 | |||
26 | /** @var IgnoredAnnotations */ |
||
27 | private $ignoredAnnotations; |
||
28 | |||
29 | /** @var int */ |
||
30 | private $nestingLevel; |
||
31 | |||
32 | 45 | public function __construct( |
|
33 | Reflector $subject, |
||
34 | Imports $imports, |
||
35 | IgnoredAnnotations $ignoredAnnotations, |
||
36 | int $nestingLevel = 0 |
||
37 | ) { |
||
38 | 45 | assert( |
|
39 | 45 | $subject instanceof ReflectionClass |
|
40 | 3 | || $subject instanceof ReflectionProperty |
|
41 | 45 | || $subject instanceof ReflectionFunctionAbstract |
|
42 | ); |
||
43 | 45 | assert($nestingLevel >= 0); |
|
44 | |||
45 | 45 | $this->subject = $subject; |
|
46 | 45 | $this->imports = $imports; |
|
47 | 45 | $this->ignoredAnnotations = $ignoredAnnotations; |
|
48 | 45 | $this->nestingLevel = $nestingLevel; |
|
49 | 45 | } |
|
50 | |||
51 | /** |
||
52 | * @return ReflectionClass|ReflectionFunctionAbstract|ReflectionProperty |
||
53 | */ |
||
54 | 21 | public function getSubject() : Reflector |
|
55 | { |
||
56 | 21 | return $this->subject; |
|
57 | } |
||
58 | |||
59 | 23 | public function getImports() : Imports |
|
60 | { |
||
61 | 23 | return $this->imports; |
|
62 | } |
||
63 | |||
64 | 8 | public function getIgnoredAnnotations() : IgnoredAnnotations |
|
65 | { |
||
66 | 8 | return $this->ignoredAnnotations; |
|
67 | } |
||
68 | |||
69 | 11 | public function isNested() : bool |
|
70 | { |
||
71 | 11 | return $this->nestingLevel > 1; |
|
72 | } |
||
73 | |||
74 | 9 | public function increaseNestingLevel() : void |
|
77 | 9 | } |
|
78 | |||
79 | 9 | public function decreaseNestingLevel() : void |
|
80 | { |
||
84 | 9 | } |
|
85 | } |
||
86 |