1 | <?php declare(strict_types = 1); |
||
18 | class MetadataBuilder |
||
19 | { |
||
20 | /** Controller classes scope name */ |
||
21 | const SCOPE_CONTROLLER = 'controllers'; |
||
22 | |||
23 | /** Service classes scope name */ |
||
24 | const SCOPE_SERVICES = 'services'; |
||
25 | |||
26 | /** @var string[] Collection of available container scopes */ |
||
27 | protected $scopes = [ |
||
28 | self::SCOPE_CONTROLLER => [], |
||
29 | self::SCOPE_SERVICES => [] |
||
30 | ]; |
||
31 | |||
32 | /** @var ClassMetadata[] Collection of classes metadata */ |
||
33 | protected $classMetadata = []; |
||
34 | |||
35 | /** @var FileManagerInterface */ |
||
36 | protected $fileManger; |
||
37 | |||
38 | /** @var ResolverInterface */ |
||
39 | protected $classResolver; |
||
40 | |||
41 | /** @var Container */ |
||
42 | protected $diContainer; |
||
43 | |||
44 | /** |
||
45 | * Container constructor. |
||
46 | * |
||
47 | * @param FileManagerInterface $fileManger |
||
48 | * @param ResolverInterface $classResolver |
||
49 | * @param Container $diContainer |
||
50 | */ |
||
51 | 5 | public function __construct( |
|
61 | |||
62 | /** |
||
63 | * Load classes from paths. |
||
64 | * |
||
65 | * @param array $paths Paths for importing |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | 1 | public function loadFromPaths(array $paths) |
|
79 | |||
80 | /** |
||
81 | * Load classes from class names collection. |
||
82 | * |
||
83 | * @param string[] $classes Collection of class names for resolving |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | 5 | public function loadFromClassNames(array $classes) |
|
101 | |||
102 | /** |
||
103 | * Find class names defined in PHP code. |
||
104 | * |
||
105 | * @param string $php PHP code for scanning |
||
106 | * |
||
107 | * @return string[] Collection of found class names in php code |
||
108 | */ |
||
109 | 2 | protected function getDefinedClasses($php) : array |
|
129 | |||
130 | /** |
||
131 | * Load classes from PHP code. |
||
132 | * |
||
133 | * @param string $php PHP code |
||
134 | * |
||
135 | * @return $this |
||
136 | */ |
||
137 | 1 | public function loadFromCode($php) |
|
147 | |||
148 | /** |
||
149 | * Build container class. |
||
150 | * |
||
151 | * @param string|null $containerClass |
||
152 | */ |
||
153 | 2 | public function build($containerClass = null) |
|
170 | } |
||
171 |