@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $regexFull = sprintf($regexBase, implode('$|', array_keys($array))); |
50 | 50 | preg_match($regexFull, $name, $match); |
51 | 51 | if (count($match) > 0 && $match[0] === $name) { |
52 | - return $this->{$match[1].'Flag'}($array[$match[2]], $arguments[0] ?? true); |
|
52 | + return $this->{$match[1] . 'Flag'}($array[$match[2]], $arguments[0] ?? true); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | throw new BadMethodCallException(sprintf('Enum %s not found on %s', $name, get_class($this))); |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | public static function toArray(): array |
79 | 79 | { |
80 | 80 | $firstTime = !isset(static::$cache[static::class]); |
81 | - $array = array_filter(parent::toArray(), function ($value): bool { |
|
81 | + $array = array_filter(parent::toArray(), function($value): bool { |
|
82 | 82 | return is_scalar($value); |
83 | 83 | }); |
84 | - $firstTime && array_walk($array, function ($item): void { |
|
84 | + $firstTime && array_walk($array, function($item): void { |
|
85 | 85 | if (!is_int($item)) { |
86 | 86 | throw new UnexpectedValueException( |
87 | 87 | sprintf('All defined Const on Enum %s should be integers', static::class) |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public static function getKeyArray($value) |
109 | 109 | { |
110 | - $f = array_filter(static::toArray(), function ($key) use (&$value) { |
|
110 | + $f = array_filter(static::toArray(), function($key) use (&$value) { |
|
111 | 111 | return $value & $key; |
112 | 112 | }); |
113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | protected static function assertValidValueReturningKey($value): string |
118 | 118 | { |
119 | 119 | if (!static::isValid($value)) { |
120 | - throw new \UnexpectedValueException("Value '$value' is not part of the enum ".static::class); |
|
120 | + throw new \UnexpectedValueException("Value '$value' is not part of the enum " . static::class); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return implode('|', self::getKeyArray($value)); |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | $array = static::toArray(); |
135 | 135 | $ret = ''; |
136 | 136 | foreach ($array as $key => $value) { |
137 | - $ret .= "'".$key."' => ".($this->{'is'.$key}() ? 'TRUE' : 'FALSE').PHP_EOL; |
|
137 | + $ret .= "'" . $key . "' => " . ($this->{'is' . $key}() ? 'TRUE' : 'FALSE') . PHP_EOL; |
|
138 | 138 | } |
139 | 139 | |
140 | - return $name.'['.PHP_EOL. |
|
141 | - $ret. |
|
142 | - ']'.PHP_EOL; |
|
140 | + return $name . '[' . PHP_EOL . |
|
141 | + $ret . |
|
142 | + ']' . PHP_EOL; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public function getName(): string |