| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.1406 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 2 | public function loadLazyProperty(string $property) |
|
| 25 | { |
||
| 26 | 2 | if (!isset($this->lazyProperties[$property])) { |
|
| 27 | throw new \Exception('Lazy property not found'); |
||
| 28 | } |
||
| 29 | 2 | if ($this->lazyProperties[$property]['loaded']) { |
|
| 30 | return $this->lazyProperties[$property]['value']; |
||
| 31 | } |
||
| 32 | 2 | $this->lazyProperties[$property]['value'] = call_user_func($this->lazyProperties[$property]['resolve']); |
|
| 33 | 2 | $this->lazyProperties[$property]['loaded'] = true; |
|
| 34 | 2 | return $this->{$property} = $this->lazyProperties[$property]['value']; |
|
| 35 | } |
||
| 43 | } |