Test Failed
Pull Request — master (#6649)
by Marco
65:32
created

LazyPropertyMap::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Doctrine\ORM\Internal\Hydration\Cache;
5
6
/**
7
 * Concept taken from ocramius/lazy-map
8
 *
9
 * @link https://github.com/Ocramius/LazyMap/blob/1.0.0/src/LazyMap/CallbackLazyMap.php
10
 * @internal do not use: internal class only
11
 */
12
final class LazyPropertyMap
13
{
14
    public function __construct(callable $instantiate)
15
    {
16
        $this->{__CLASS__ . "\0callback"} = $instantiate;
17
    }
18
19
    /**
20
     * @param string $name
21
     *
22
     * @return mixed
23
     */
24
    public function __get(string $name)
25
    {
26
        $this->$name = ($this->{__CLASS__ . "\0callback"})($name);
27
28
        return $this->$name;
29
    }
30
}
31