1 | <?php |
||
25 | final class Printer |
||
26 | { |
||
27 | public const RESOLVER_PROPERTY = 'resolver'; |
||
28 | public const UNSET_PROPERTIES_CONST = 'UNSET_PROPERTIES'; |
||
29 | public const PUBLIC_PROPERTIES_CONST = 'PUBLIC_PROPERTIES'; |
||
30 | public const INIT_METHOD = '__init'; |
||
31 | |||
32 | private const LOADED_METHOD = '__loaded'; |
||
33 | private const ROLE_METHOD = '__role'; |
||
34 | private const SCOPE_METHOD = '__scope'; |
||
35 | private const RESOLVE_METHOD = '__resolve'; |
||
36 | |||
37 | private const DEPENDENCIES = [ |
||
38 | 'orm' => ORMInterface::class, |
||
39 | 'role' => 'string', |
||
40 | 'scope' => 'array' |
||
41 | ]; |
||
42 | |||
43 | private const USE_STMTS = [ |
||
44 | PromiseInterface::class, |
||
45 | Resolver::class, |
||
46 | ProxyFactoryException::class, |
||
47 | ORMInterface::class |
||
48 | ]; |
||
49 | |||
50 | private const PROMISE_METHODS = [ |
||
51 | self::LOADED_METHOD => 'bool', |
||
52 | self::ROLE_METHOD => 'string', |
||
53 | self::SCOPE_METHOD => 'array', |
||
54 | self::RESOLVE_METHOD => null, |
||
55 | ]; |
||
56 | |||
57 | /** @var ConflictResolver */ |
||
58 | private $resolver; |
||
59 | |||
60 | /** @var Traverser */ |
||
61 | private $traverser; |
||
62 | |||
63 | /** @var Declaration\Extractor */ |
||
64 | private $extractor; |
||
65 | |||
66 | /** @var Lexer */ |
||
67 | private $lexer; |
||
68 | |||
69 | /** @var Parser */ |
||
70 | private $parser; |
||
71 | |||
72 | /** @var PrettyPrinterAbstract */ |
||
73 | private $printer; |
||
74 | |||
75 | /** |
||
76 | * @param Declaration\Extractor $extractor |
||
77 | * @param ConflictResolver $resolver |
||
78 | * @param Traverser $traverser |
||
79 | */ |
||
80 | public function __construct( |
||
104 | |||
105 | /** |
||
106 | * @param ReflectionClass $reflection |
||
107 | * @param Declaration\DeclarationInterface $class |
||
108 | * @param Declaration\DeclarationInterface $parent |
||
109 | * @return string |
||
110 | * @throws ProxyFactoryException |
||
111 | * @throws ReflectionException |
||
112 | */ |
||
113 | public function make( |
||
200 | |||
201 | /** |
||
202 | * @param Declaration\Structure $structure |
||
203 | * @return string |
||
204 | */ |
||
205 | public function initMethodName(Declaration\Structure $structure): string |
||
209 | |||
210 | /** |
||
211 | * @param Declaration\Structure $structure |
||
212 | * @return string |
||
213 | */ |
||
214 | private function resolverPropertyName(Declaration\Structure $structure): string |
||
218 | |||
219 | /** |
||
220 | * @param Declaration\Structure $structure |
||
221 | * @return string |
||
222 | */ |
||
223 | private function unsetPropertiesConstName(Declaration\Structure $structure): string |
||
227 | |||
228 | /** |
||
229 | * @param Declaration\Structure $structure |
||
230 | * @return string |
||
231 | */ |
||
232 | private function publicPropertiesConstName(Declaration\Structure $structure): string |
||
236 | |||
237 | /** |
||
238 | * @param Declaration\DeclarationInterface $class |
||
239 | * @param Declaration\DeclarationInterface $parent |
||
240 | * @return array |
||
241 | */ |
||
242 | private function useStmts(Declaration\DeclarationInterface $class, Declaration\DeclarationInterface $parent): array |
||
251 | |||
252 | /** |
||
253 | * @return string |
||
254 | */ |
||
255 | private function propertyType(): string |
||
259 | |||
260 | /** |
||
261 | * @return Node\Stmt[] |
||
262 | */ |
||
263 | private function getNodesFromStub(): array |
||
267 | } |
||
268 |