| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.1502 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 2 | public function __get($name) |
|
| 22 | { |
||
| 23 | 2 | if (!isset(self::$property_like_methods)) { |
|
|
|
|||
| 24 | throw new \LogicException(static::class.'::$property_like_methods is not set.'); |
||
| 25 | } |
||
| 26 | |||
| 27 | 2 | if (isset(self::$property_like_methods[$name])) { |
|
| 28 | 1 | $method = self::$property_like_methods[$name]; |
|
| 29 | 2 | } elseif (in_array($name, self::$property_like_methods)) { |
|
| 30 | 1 | $method = $name; |
|
| 31 | 1 | } elseif (property_exists($this, $name)) { |
|
| 32 | return $this->$name; |
||
| 33 | } else { |
||
| 34 | 1 | throw new \OutOfRangeException("Unexpected key:'$name'"); |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | return call_user_func([$this, $method]); |
|
| 38 | } |
||
| 40 |