Total Complexity | 3 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | final class GetByClosure implements GetterStrategy |
||
22 | { |
||
23 | /** |
||
24 | * The name of the property |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | public $propertyName; |
||
29 | |||
30 | /** |
||
31 | * The name of the class |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | public $className; |
||
36 | |||
37 | /** |
||
38 | * The cached closure |
||
39 | * |
||
40 | * @var Closure |
||
41 | */ |
||
42 | public $getter; |
||
43 | |||
44 | /** |
||
45 | * Constructor |
||
46 | * |
||
47 | * @param string $propertyName |
||
48 | * @param string $className |
||
49 | */ |
||
50 | 3 | public function __construct(string $propertyName, string $className) |
|
51 | { |
||
52 | 3 | $this->propertyName = $propertyName; |
|
53 | 3 | $this->className = $className; |
|
54 | 3 | } |
|
55 | |||
56 | /** |
||
57 | * Get object value by binding a closure to the class |
||
58 | * |
||
59 | * @param object $object |
||
60 | * @return mixed |
||
61 | */ |
||
62 | 3 | public function get($object) |
|
73 | } |
||
74 | } |
||
75 |