dmt-software /
insolvency-client
| 1 | <?php |
||
| 2 | |||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 3 | namespace DMT\Insolvency\Model; |
||
| 4 | |||
| 5 | trait LazyLoadingPropertyTrait |
||
|
0 ignored issues
–
show
|
|||
| 6 | { |
||
| 7 | 7 | public function __get($key) |
|
|
0 ignored issues
–
show
|
|||
| 8 | { |
||
| 9 | 7 | if (!property_exists($this, $key)) { |
|
| 10 | throw new \InvalidArgumentException(sprintf('%s does not exists on %s', $key, get_class($this))); |
||
| 11 | } |
||
| 12 | |||
| 13 | 7 | if ($this->$key instanceof \Closure) { |
|
| 14 | 7 | $this->$key = call_user_func($this->$key); |
|
| 15 | } |
||
| 16 | |||
| 17 | 7 | return $this->$key; |
|
| 18 | } |
||
| 19 | } |