1 | <?php |
||
21 | final class Printer |
||
22 | { |
||
23 | private const RESOLVER_PROPERTY = '__resolver'; |
||
24 | private const UNSET_PROPERTIES_CONST = 'UNSET_PROPERTIES'; |
||
25 | private const INIT_METHOD = '__init'; |
||
26 | |||
27 | private const LOADED_METHOD = '__loaded'; |
||
28 | private const ROLE_METHOD = '__role'; |
||
29 | private const SCOPE_METHOD = '__scope'; |
||
30 | private const RESOLVE_METHOD = '__resolve'; |
||
31 | |||
32 | private const DEPENDENCIES = [ |
||
33 | 'orm' => ORMInterface::class, |
||
34 | 'role' => 'string', |
||
35 | 'scope' => 'array' |
||
36 | ]; |
||
37 | |||
38 | private const USE_STMTS = [ |
||
39 | PromiseInterface::class, |
||
40 | Resolver::class, |
||
41 | ProxyFactoryException::class, |
||
42 | ORMInterface::class |
||
43 | ]; |
||
44 | |||
45 | private const PROMISE_METHODS = [ |
||
46 | self::LOADED_METHOD => 'bool', |
||
47 | self::ROLE_METHOD => 'string', |
||
48 | self::SCOPE_METHOD => 'array', |
||
49 | self::RESOLVE_METHOD => null, |
||
50 | ]; |
||
51 | |||
52 | /** @var ConflictResolver */ |
||
53 | private $resolver; |
||
54 | |||
55 | /** @var Traverser */ |
||
56 | private $traverser; |
||
57 | |||
58 | /** @var Declaration\Extractor */ |
||
59 | private $extractor; |
||
60 | |||
61 | /** @var Lexer */ |
||
62 | private $lexer; |
||
63 | |||
64 | /** @var Parser */ |
||
65 | private $parser; |
||
66 | |||
67 | /** @var PrettyPrinterAbstract */ |
||
68 | private $printer; |
||
69 | |||
70 | /** @var Stubs */ |
||
71 | private $stubs; |
||
72 | |||
73 | /** |
||
74 | * @param ConflictResolver $resolver |
||
75 | * @param Traverser $traverser |
||
76 | * @param Declaration\Extractor $extractor |
||
77 | * @param Stubs $stubs |
||
78 | */ |
||
79 | public function __construct( |
||
105 | |||
106 | /** |
||
107 | * @param \ReflectionClass $reflection |
||
108 | * @param Declaration\DeclarationInterface $class |
||
109 | * @param Declaration\DeclarationInterface $parent |
||
110 | * @return string |
||
111 | * |
||
112 | * @throws ProxyFactoryException |
||
113 | */ |
||
114 | public function make( |
||
173 | |||
174 | /** |
||
175 | * @param Declaration\Structure $structure |
||
176 | * @return string |
||
177 | */ |
||
178 | public function initMethodName(Declaration\Structure $structure): string |
||
182 | |||
183 | /** |
||
184 | * @param Declaration\Structure $structure |
||
185 | * @return string |
||
186 | */ |
||
187 | private function resolverPropertyName(Declaration\Structure $structure): string |
||
191 | |||
192 | /** |
||
193 | * @param Declaration\Structure $structure |
||
194 | * @return string |
||
195 | */ |
||
196 | private function unsetPropertiesConstName(Declaration\Structure $structure): string |
||
200 | |||
201 | /** |
||
202 | * @param Declaration\DeclarationInterface $class |
||
203 | * @param Declaration\DeclarationInterface $parent |
||
204 | * @return array |
||
205 | */ |
||
206 | private function useStmts(Declaration\DeclarationInterface $class, Declaration\DeclarationInterface $parent): array |
||
215 | |||
216 | /** |
||
217 | * @return string |
||
218 | */ |
||
219 | private function propertyType(): string |
||
223 | |||
224 | /** |
||
225 | * @return Node\Stmt[] |
||
226 | */ |
||
227 | private function getNodesFromStub(): array |
||
231 | } |