1 | <?php |
||
32 | class Compiler implements CompilerInterface |
||
33 | { |
||
34 | /** |
||
35 | * @var ReflectionInterface |
||
36 | */ |
||
37 | private $reflection; |
||
38 | |||
39 | /** |
||
40 | * @var Frontend |
||
41 | */ |
||
42 | private $frontend; |
||
43 | |||
44 | /** |
||
45 | * @var Backend |
||
46 | */ |
||
47 | private $backend; |
||
48 | |||
49 | /** |
||
50 | * @var Process |
||
51 | */ |
||
52 | private $process; |
||
53 | |||
54 | /** |
||
55 | * @var array|TypeLoaderInterface[] |
||
56 | */ |
||
57 | private $loaders = []; |
||
58 | |||
59 | /** |
||
60 | * Compiler constructor. |
||
61 | */ |
||
62 | public function __construct() |
||
69 | |||
70 | /** |
||
71 | * @param TypeLoaderInterface $loader |
||
72 | */ |
||
73 | public function autoload(TypeLoaderInterface $loader): void |
||
77 | |||
78 | /** |
||
79 | * @return \Closure |
||
80 | */ |
||
81 | private function typeLoader(): \Closure |
||
93 | |||
94 | /** |
||
95 | * @param Readable $schema |
||
96 | * @return DocumentInterface |
||
97 | * @throws ExternalFileException |
||
98 | * @throws InternalErrorException |
||
99 | */ |
||
100 | public function compile(Readable $schema): DocumentInterface |
||
118 | |||
119 | /** |
||
120 | * @param Readable $schema |
||
121 | * @return DocumentInterface |
||
122 | * @throws InternalErrorException |
||
123 | * @throws SyntaxException |
||
124 | * @throws TypeException |
||
125 | */ |
||
126 | private function runCompiler(Readable $schema): DocumentInterface |
||
130 | |||
131 | /** |
||
132 | * @param ReflectionInterface $reflection |
||
133 | * @param Readable $schema |
||
134 | * @return DocumentInterface |
||
135 | * @throws InternalErrorException |
||
136 | * @throws SyntaxException |
||
137 | * @throws TypeException |
||
138 | */ |
||
139 | private function run(ReflectionInterface $reflection, Readable $schema): DocumentInterface |
||
146 | |||
147 | /** |
||
148 | * @param ReflectionInterface $reflection |
||
149 | * @param Readable $schema |
||
150 | * @return DocumentInterface |
||
151 | */ |
||
152 | private function document(ReflectionInterface $reflection, Readable $schema): DocumentInterface |
||
156 | |||
157 | /** |
||
158 | * @param Readable $schema |
||
159 | * @return ReflectionInterface |
||
160 | * @throws InternalErrorException |
||
161 | * @throws SyntaxException |
||
162 | * @throws TypeException |
||
163 | */ |
||
164 | public function preload(Readable $schema): ReflectionInterface |
||
170 | } |
||
171 |