1 | <?php |
||
13 | class Compiler |
||
14 | { |
||
15 | /** |
||
16 | * @var DefinitionInterface[] |
||
17 | */ |
||
18 | private $definitions = []; |
||
19 | |||
20 | /** |
||
21 | * @var DumpableInterface[] |
||
22 | */ |
||
23 | private $dumpableDefinitions = []; |
||
24 | |||
25 | /** |
||
26 | * The object in charge of converting container-interop definitions to our internal standard. |
||
27 | * |
||
28 | * @var DefinitionConverterInterface |
||
29 | */ |
||
30 | private $converter; |
||
31 | |||
32 | /** |
||
33 | * @param DefinitionConverterInterface $converter The object in charge of converting container-interop definitions to our internal standard. |
||
34 | */ |
||
35 | public function __construct(DefinitionConverterInterface $converter = null) |
||
42 | |||
43 | /** |
||
44 | * Adds a definition to the list of definitions managed by this compiler. |
||
45 | * |
||
46 | * @param DefinitionInterface $definition |
||
47 | */ |
||
48 | public function addDefinition(DefinitionInterface $definition) |
||
53 | |||
54 | /** |
||
55 | * Registers a new definition provider. |
||
56 | * |
||
57 | * @param DefinitionProviderInterface $definitionProvider |
||
58 | */ |
||
59 | public function register(DefinitionProviderInterface $definitionProvider) { |
||
64 | |||
65 | /** |
||
66 | * Adds a dumpable definition to the list of definitions managed by this compiler. |
||
67 | * Note: a "dumpable" definition is a definition represented in Yaco internal format. |
||
68 | * |
||
69 | * @param DumpableInterface $dumpableDefinition |
||
70 | */ |
||
71 | public function addDumpableDefinition(DumpableInterface $dumpableDefinition) |
||
76 | |||
77 | /** |
||
78 | * @param string $className |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function compile($className) |
||
123 | |||
124 | private function splitFQCN($className) |
||
140 | |||
141 | private function getParametersCode(InlineEntryInterface $inlineEntry) |
||
149 | |||
150 | private function getClosureCode(InlineEntryInterface $inlineEntry) |
||
157 | } |
||
158 |