1 | <?php |
||
23 | final class Project implements ProjectInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $name = ''; |
||
29 | |||
30 | /** |
||
31 | * @var Namespace_|null |
||
32 | */ |
||
33 | private $rootNamespace; |
||
34 | |||
35 | /** |
||
36 | * @var File[] |
||
37 | */ |
||
38 | private $files = []; |
||
39 | |||
40 | /** |
||
41 | * @var Namespace_[] |
||
42 | */ |
||
43 | private $namespaces = []; |
||
44 | |||
45 | /** |
||
46 | * Initializes this descriptor. |
||
47 | * |
||
48 | * @param string $name Name of the current project. |
||
49 | * @param null|Namespace_ $namespace Root namespace of the project. |
||
50 | */ |
||
51 | 2 | public function __construct(string $name, ?Namespace_ $namespace = null) |
|
59 | |||
60 | /** |
||
61 | * Returns the name of this project. |
||
62 | */ |
||
63 | 1 | public function getName(): string |
|
67 | |||
68 | /** |
||
69 | * Returns all files with their sub-elements. |
||
70 | * |
||
71 | * @return File[] |
||
72 | */ |
||
73 | 1 | public function getFiles(): array |
|
77 | |||
78 | /** |
||
79 | * Add a file to this project. |
||
80 | */ |
||
81 | 1 | public function addFile(File $file): void |
|
85 | |||
86 | /** |
||
87 | * Returns all namespaces with their sub-elements. |
||
88 | * |
||
89 | * @return Namespace_[] |
||
90 | */ |
||
91 | 1 | public function getNamespaces(): array |
|
95 | |||
96 | /** |
||
97 | * Add a namespace to the project. |
||
98 | */ |
||
99 | 1 | public function addNamespace(Namespace_ $namespace): void |
|
103 | |||
104 | /** |
||
105 | * Returns the root (global) namespace. |
||
106 | */ |
||
107 | 1 | public function getRootNamespace(): ?Namespace_ |
|
111 | } |
||
112 |