Completed
Pull Request — master (#35)
by Aleh
03:05
created

FileScope::getInterface()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
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 getNamespace()
24
    {
25
        return $this->uses->getFQCN();
26
    }
27
    public function getUses()
28
    {
29
        return $this->uses;
30
    }
31
    public function getClasses()
32
    {
33
        return $this->classes;
34
    }
35
    public function getClass($className)
36
    {
37
        if (array_key_exists($className, $this->classes)) {
38
            return $this->classes[$className];
39
        }
40
    }
41
    public function addClass(ClassData $class)
42
    {
43
        $this->classes[$class->getName()] = $class;
44
    }
45
    public function getInterfaces()
46
    {
47
        return $this->interfaces;
48
    }
49
    public function getInterface($interfaceName)
50
    {
51
        if (array_key_exists($interfaceName, $this->interfaces)) {
52
            return $this->interfaces[$interfaceName];
53
        }
54
    }
55
    public function addInterface(InterfaceData $interface)
56
    {
57
        $this->interfaces[$interface->getName()] = $interface;
58
    }
59
}
60