1 | <?php |
||
21 | class Instantiator |
||
22 | { |
||
23 | /** |
||
24 | * @var \ReflectionClass |
||
25 | */ |
||
26 | private $class; |
||
27 | |||
28 | /** |
||
29 | * Set class to instantiate |
||
30 | */ |
||
31 | public function setReflectionClass(\ReflectionClass $class): void |
||
35 | |||
36 | /** |
||
37 | * Get loaded reflection class |
||
38 | * |
||
39 | * @throws LogicException If reflected class is not loaded |
||
40 | */ |
||
41 | public function getReflectionClass(): \ReflectionClass |
||
48 | |||
49 | /** |
||
50 | * Get number of required constructor parameters |
||
51 | */ |
||
52 | public function countConstructorArgs(): int |
||
59 | |||
60 | /** |
||
61 | * Check if class is instantiable |
||
62 | */ |
||
63 | public function isInstantiable(): bool |
||
67 | |||
68 | /** |
||
69 | * Check if class is instantiable without constructor parameters |
||
70 | */ |
||
71 | public function isInstantiableWithoutArgs(): bool |
||
75 | |||
76 | /** |
||
77 | * Create instance |
||
78 | * |
||
79 | * @param array $args Optional constructor arguments |
||
80 | * @return mixed Instance of reflected class |
||
81 | * @throws LogicException If reflected class is not instantiable |
||
82 | */ |
||
83 | public function instantiate(array $args = array()) |
||
95 | } |
||
96 |