Conditions | 1 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | $this->tmpDir = $tmpDir ?? sys_get_temp_dir(); |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param class-string<T> $class |
||
|
|||
23 | * |
||
24 | * @return T |
||
25 | * |
||
26 | * @template T of object |
||
27 | */ |
||
28 | public function newInstance(string $class, string $method, Logger $spyLog): object |
||
29 | { |
||
30 | $bind = (new Bind())->bindInterceptors($method, [new SpyInterceptor($spyLog)]); |
||
31 | $compiler = new Weaver($bind, $this->tmpDir); |
||
32 | |||
33 | return $compiler->newInstance($class, []); |
||
34 | } |
||
35 | } |
||
36 |