| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public function __call($method, array $arguments) |
||
| 10 | { |
||
| 11 | $string = S::create($method); |
||
| 12 | if (!$string->startsWithAny(['has', 'get', 'is', 'set'])) { |
||
| 13 | throw new \BadMethodCallException($method); |
||
| 14 | } |
||
| 15 | |||
| 16 | $property = lcfirst(preg_replace('/^(has|get|is|set)/', '', $method)); |
||
| 17 | if ($string->startsWithAny(['set'])) { |
||
| 18 | $this->$property = current($arguments); |
||
| 19 | |||
| 20 | return $this; |
||
| 21 | } |
||
| 22 | |||
| 23 | if (property_exists($this, $property)) { |
||
| 24 | return $this->$property; |
||
| 25 | } |
||
| 26 | |||
| 27 | throw new \BadMethodCallException(); |
||
| 28 | } |
||
| 29 | } |
||
| 30 |