Passed
Push — master ( 08ad67...bd34c5 )
by Jesse
02:05
created

ProxyingWithoutConstructor::_load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Proxy;
4
5
/**
6
 * Proxying behaviour. Basic behaviour for easily creating a proxy class.
7
 *
8
 * @author Stratadox
9
 */
10
trait ProxyingWithoutConstructor
11
{
12
    /** @var null|static */
13
    private $instance;
14
    /** @var ProxyLoader */
15
    private $loader;
16
    /** @var array */
17
    private $knownData;
18
19
    /** @return static */
20
    private function _load()
21
    {
22
        if (null === $this->instance) {
23
            $this->instance = $this->loader->loadTheInstance($this->knownData);
24
        }
25
        return $this->instance;
26
    }
27
}
28