Completed
Push — master ( 7a0ba6...43e06c )
by Aleh
13s
created

FileScope::getFQCN()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Padawan\Domain\Scope;
4
5
use Padawan\Domain\Project\FQN;
6
use Padawan\Domain\Project\Node\Uses;
7
use Padawan\Domain\Project\Node\ClassData;
8
use Padawan\Domain\Project\Node\InterfaceData;
9
10
class FileScope extends AbstractScope
11
{
12
    private $classes = [];
13
    private $interfaces = [];
14
    /** @var FQCN */
15
    private $namespace;
0 ignored issues
show
Unused Code introduced by
The property $namespace is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
16
    /** @var Uses */
17
    private $uses;
18
19
    public function __construct(FQN $namespace, Uses $uses = null)
20
    {
21
        $this->uses = $uses;
22
    }
23
    public function getFQCN()
24
    {
25
        return $this->uses ? $this->uses->getFQCN() : null;
26
    }
27
    public function getNamespace()
28
    {
29
        return $this->uses ? $this->uses->getFQCN() : null;
30
    }
31
    public function getUses()
32
    {
33
        return $this->uses;
34
    }
35
    public function getClasses()
36
    {
37
        return $this->classes;
38
    }
39
    public function getClass($className)
40
    {
41
        if (array_key_exists($className, $this->classes)) {
42
            return $this->classes[$className];
43
        }
44
    }
45
    public function addClass(ClassData $class)
46
    {
47
        $this->classes[$class->getName()] = $class;
48
    }
49
    public function getInterfaces()
50
    {
51
        return $this->interfaces;
52
    }
53
    public function getInterface($interfaceName)
54
    {
55
        if (array_key_exists($interfaceName, $this->interfaces)) {
56
            return $this->interfaces[$interfaceName];
57
        }
58
    }
59
    public function addInterface(InterfaceData $interface)
60
    {
61
        $this->interfaces[$interface->getName()] = $interface;
62
    }
63
}
64