Conditions | 3 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function __call($name, $arguments) |
||
24 | { |
||
25 | $array = static::toArray(); |
||
26 | $regexBase = '/(is)(%s)/m'; |
||
27 | $regexFull = sprintf($regexBase, implode('$|', array_keys($array))); |
||
28 | preg_match($regexFull, $name, $match); |
||
29 | if (count($match)>0 && $match[0] === $name) { |
||
30 | return $this->{$match[1] . 'Flag'}($array[$match[2]], $arguments[0] ?? null); |
||
31 | } |
||
32 | throw new BadMethodCallException(sprintf('Enum %s not found on %s', $name, get_class($this))); |
||
33 | } |
||
59 |