1 | <?php |
||
14 | class Printer |
||
15 | { |
||
16 | private const RESOLVER_PROPERTY = '__resolver'; |
||
17 | private const UNSET_PROPERTIES_CONST = 'UNSET_PROPERTIES'; |
||
18 | private const INIT_METHOD = '__init'; |
||
19 | |||
20 | private const LOADED_METHOD = '__loaded'; |
||
21 | private const ROLE_METHOD = '__role'; |
||
22 | private const SCOPE_METHOD = '__scope'; |
||
23 | private const RESOLVE_METHOD = '__resolve'; |
||
24 | |||
25 | private const DEPENDENCIES = [ |
||
26 | 'orm' => ORMInterface::class, |
||
27 | 'role' => 'string', |
||
28 | 'scope' => 'array' |
||
29 | ]; |
||
30 | |||
31 | private const USE_STMTS = [ |
||
32 | PromiseInterface::class, |
||
33 | PromiseResolver::class, |
||
34 | PromiseException::class, |
||
35 | ORMInterface::class |
||
36 | ]; |
||
37 | |||
38 | private const PROMISE_METHODS = [ |
||
39 | self::LOADED_METHOD => 'bool', |
||
40 | self::ROLE_METHOD => 'string', |
||
41 | self::SCOPE_METHOD => 'array', |
||
42 | self::RESOLVE_METHOD => null, |
||
43 | ]; |
||
44 | |||
45 | /** @var ConflictResolver */ |
||
46 | private $resolver; |
||
47 | |||
48 | /** @var Traverser */ |
||
49 | private $traverser; |
||
50 | |||
51 | /** @var Declaration\Extractor */ |
||
52 | private $extractor; |
||
53 | |||
54 | /** @var Lexer */ |
||
55 | private $lexer; |
||
56 | |||
57 | /** @var Parser */ |
||
58 | private $parser; |
||
59 | |||
60 | /** @var PrettyPrinterAbstract */ |
||
61 | private $printer; |
||
62 | |||
63 | /** @var Stubs */ |
||
64 | private $stubs; |
||
65 | |||
66 | public function __construct(ConflictResolver $resolver, Traverser $traverser, Declaration\Extractor $extractor, Stubs $stubs) |
||
88 | |||
89 | /** |
||
90 | * @param \ReflectionClass $reflection |
||
91 | * @param Declaration\DeclarationInterface $class |
||
92 | * @param Declaration\DeclarationInterface $parent |
||
93 | * |
||
94 | * @return string |
||
95 | * @throws \Cycle\ORM\Promise\ProxyFactoryException |
||
96 | */ |
||
97 | public function make(\ReflectionClass $reflection, Declaration\DeclarationInterface $class, Declaration\DeclarationInterface $parent): string |
||
152 | |||
153 | public function initMethodName(Declaration\Structure $structure): string |
||
157 | |||
158 | private function resolverPropertyName(Declaration\Structure $structure): string |
||
162 | |||
163 | private function unsetPropertiesConstName(Declaration\Structure $structure): string |
||
167 | |||
168 | private function useStmts(Declaration\DeclarationInterface $class, Declaration\DeclarationInterface $parent): array |
||
177 | |||
178 | private function propertyType(): string |
||
182 | |||
183 | /** |
||
184 | * @return Node\Stmt[] |
||
185 | */ |
||
186 | private function getNodesFromStub(): array |
||
190 | } |