@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | protected static function assertValidValueReturningKey($value): string |
| 18 | 18 | { |
| 19 | 19 | if (!static::isValid($value)) { |
| 20 | - throw new UnexpectedValueException("Value '$value' is not part of the enum ".static::class); |
|
| 20 | + throw new UnexpectedValueException("Value '$value' is not part of the enum " . static::class); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return implode('|', self::getKeyArray($value)); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $regexFull = sprintf($regexBase, implode('$|', array_keys($array))); |
| 52 | 52 | preg_match($regexFull, $name, $match); |
| 53 | 53 | if (count($match) > 0 && $match[0] === $name) { |
| 54 | - return $this->{$match[1].'Flag'}($array[$match[2]], $arguments[0] ?? true); |
|
| 54 | + return $this->{$match[1] . 'Flag'}($array[$match[2]], $arguments[0] ?? true); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | throw new BadMethodCallException(sprintf('Enum %s not found on %s', $name, get_class($this))); |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | public static function toArray(): array |
| 64 | 64 | { |
| 65 | 65 | $firstTime = !isset(static::$cache[static::class]); |
| 66 | - $array = array_filter(parent::toArray(), static function ($value): bool { |
|
| 66 | + $array = array_filter(parent::toArray(), static function($value): bool { |
|
| 67 | 67 | return is_scalar($value); |
| 68 | 68 | }); |
| 69 | - $firstTime && array_walk($array, static function ($item): void { |
|
| 69 | + $firstTime && array_walk($array, static function($item): void { |
|
| 70 | 70 | if (!is_int($item)) { |
| 71 | 71 | throw new UnexpectedValueException( |
| 72 | 72 | sprintf('All defined Const on Enum %s should be integers', static::class) |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public static function getKeyArray(mixed $value): array |
| 94 | 94 | { |
| 95 | - $f = array_filter(static::toArray(), static function ($key) use (&$value) { |
|
| 95 | + $f = array_filter(static::toArray(), static function($key) use (&$value) { |
|
| 96 | 96 | return $value & $key; |
| 97 | 97 | }); |
| 98 | 98 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | $array = static::toArray(); |
| 111 | 111 | $ret = ''; |
| 112 | 112 | foreach ($array as $key => $value) { |
| 113 | - $ret .= "'".$key."' => ".($this->{'is'.$key}() ? 'TRUE' : 'FALSE').PHP_EOL; |
|
| 113 | + $ret .= "'" . $key . "' => " . ($this->{'is' . $key}() ? 'TRUE' : 'FALSE') . PHP_EOL; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - return $name.'['.PHP_EOL. |
|
| 117 | - $ret. |
|
| 118 | - ']'.PHP_EOL; |
|
| 116 | + return $name . '[' . PHP_EOL . |
|
| 117 | + $ret . |
|
| 118 | + ']' . PHP_EOL; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function getName(): string |