1 | <?php |
||
23 | final class Printer |
||
24 | { |
||
25 | public const RESOLVER_PROPERTY = 'resolver'; |
||
26 | public const UNSET_PROPERTIES_CONST = 'UNSET_PROPERTIES'; |
||
27 | public const PUBLIC_PROPERTIES_CONST = 'PUBLIC_PROPERTIES'; |
||
28 | public const INIT_METHOD = '__init'; |
||
29 | |||
30 | private const LOADED_METHOD = '__loaded'; |
||
31 | private const ROLE_METHOD = '__role'; |
||
32 | private const SCOPE_METHOD = '__scope'; |
||
33 | private const RESOLVE_METHOD = '__resolve'; |
||
34 | |||
35 | private const DEPENDENCIES = [ |
||
36 | 'orm' => ORMInterface::class, |
||
37 | 'role' => 'string', |
||
38 | 'scope' => 'array' |
||
39 | ]; |
||
40 | |||
41 | private const USE_STMTS = [ |
||
42 | PromiseInterface::class, |
||
43 | Resolver::class, |
||
44 | ProxyFactoryException::class, |
||
45 | ORMInterface::class |
||
46 | ]; |
||
47 | |||
48 | private const PROMISE_METHODS = [ |
||
49 | self::LOADED_METHOD => 'bool', |
||
50 | self::ROLE_METHOD => 'string', |
||
51 | self::SCOPE_METHOD => 'array', |
||
52 | self::RESOLVE_METHOD => null, |
||
53 | ]; |
||
54 | |||
55 | /** @var ConflictResolver */ |
||
56 | private $resolver; |
||
57 | |||
58 | /** @var Traverser */ |
||
59 | private $traverser; |
||
60 | |||
61 | /** @var Declaration\Extractor */ |
||
62 | private $extractor; |
||
63 | |||
64 | /** @var Lexer */ |
||
65 | private $lexer; |
||
66 | |||
67 | /** @var Parser */ |
||
68 | private $parser; |
||
69 | |||
70 | /** @var PrettyPrinterAbstract */ |
||
71 | private $printer; |
||
72 | |||
73 | /** |
||
74 | * @param Declaration\Extractor $extractor |
||
75 | * @param ConflictResolver $resolver |
||
76 | * @param Traverser $traverser |
||
77 | */ |
||
78 | public function __construct( |
||
102 | |||
103 | /** |
||
104 | * @param \ReflectionClass $reflection |
||
105 | * @param Declaration\DeclarationInterface $class |
||
106 | * @param Declaration\DeclarationInterface $parent |
||
107 | * @return string |
||
108 | * @throws ProxyFactoryException |
||
109 | * @throws \ReflectionException |
||
110 | */ |
||
111 | public function make( |
||
175 | |||
176 | /** |
||
177 | * @param Declaration\Structure $structure |
||
178 | * @return string |
||
179 | */ |
||
180 | public function initMethodName(Declaration\Structure $structure): string |
||
184 | |||
185 | /** |
||
186 | * @param Declaration\Structure $structure |
||
187 | * @return string |
||
188 | */ |
||
189 | private function resolverPropertyName(Declaration\Structure $structure): string |
||
193 | |||
194 | /** |
||
195 | * @param Declaration\Structure $structure |
||
196 | * @return string |
||
197 | */ |
||
198 | private function unsetPropertiesConstName(Declaration\Structure $structure): string |
||
202 | |||
203 | /** |
||
204 | * @param Declaration\Structure $structure |
||
205 | * @return string |
||
206 | */ |
||
207 | private function publicPropertiesConstName(Declaration\Structure $structure): string |
||
211 | |||
212 | /** |
||
213 | * @param Declaration\DeclarationInterface $class |
||
214 | * @param Declaration\DeclarationInterface $parent |
||
215 | * @return array |
||
216 | */ |
||
217 | private function useStmts(Declaration\DeclarationInterface $class, Declaration\DeclarationInterface $parent): array |
||
226 | |||
227 | /** |
||
228 | * @return string |
||
229 | */ |
||
230 | private function propertyType(): string |
||
234 | |||
235 | /** |
||
236 | * @return Node\Stmt[] |
||
237 | */ |
||
238 | private function getNodesFromStub(): array |
||
242 | } |
||
243 |