Completed
Push — master ( 3be072...ba2d3a )
by Marco
231:32 queued 209:55
created

LazyLoadingValueHolderFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 24
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\Factory;
6
7
use Closure;
8
use ProxyManager\Configuration;
9
use ProxyManager\Proxy\VirtualProxyInterface;
10
use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator;
11
use ProxyManager\ProxyGenerator\ProxyGeneratorInterface;
12
13
/**
14
 * Factory responsible of producing virtual proxy instances
15
 */
16
class LazyLoadingValueHolderFactory extends AbstractBaseFactory
17
{
18
    private LazyLoadingValueHolderGenerator $generator;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
19
20
    public function __construct(?Configuration $configuration = null)
21 2
    {
22
        parent::__construct($configuration);
23
24
        $this->generator = new LazyLoadingValueHolderGenerator();
25
    }
26 2
27
    /** @param mixed[] $proxyOptions */
28 2
    public function createProxy(
29
        string $className,
30
        Closure $initializer,
31
        array $proxyOptions = []
32
    ) : VirtualProxyInterface {
33
        $proxyClassName = $this->generateProxy($className, $proxyOptions);
34 1
35
        return $proxyClassName::staticProxyConstructor($initializer);
36 1
    }
37
38
    /**
39
     * {@inheritDoc}
40
     */
41
    protected function getGenerator() : ProxyGeneratorInterface
42
    {
43
        return $this->generator;
44
    }
45
}
46