Conditions | 2 |
Paths | 2 |
Total Lines | 29 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | protected function instantiate($class, $constructorArg = []) |
||
40 | { |
||
41 | if (!class_exists($class)) { |
||
42 | throw new \InvalidArgumentException( |
||
43 | sprintf("Class '%s' not exists.", $class) |
||
44 | ); |
||
45 | } |
||
46 | |||
47 | $proxy = $this->proxy->createProxy( |
||
48 | $class, |
||
49 | function ( |
||
50 | &$wrappedObject, |
||
51 | $proxy, |
||
52 | $method, |
||
53 | $parameters, |
||
54 | &$initializer |
||
55 | ) use ( |
||
56 | $class, |
||
57 | $constructorArg |
||
58 | ) { |
||
59 | $wrappedObject = (new \ReflectionClass($class))->newInstanceArgs($constructorArg); |
||
60 | $initializer = null; |
||
61 | |||
62 | return true; |
||
63 | } |
||
64 | ); |
||
65 | |||
66 | return $proxy; |
||
67 | } |
||
68 | } |
||
69 |