| @@ 160-170 (lines=11) @@ | ||
| 157 | $readables = $enumFqcn::readables(); |
|
| 158 | ||
| 159 | // Generate all values |
|
| 160 | foreach ($this->getEnumerableValues($enumFqcn) as $constant => $value) { |
|
| 161 | if (!$readable = $readables[$value] ?? false) { |
|
| 162 | continue; |
|
| 163 | } |
|
| 164 | ||
| 165 | $readablesCode .= |
|
| 166 | <<<JS |
|
| 167 | ||
| 168 | [{$shortName}.{$constant}]: '{$readable}', |
|
| 169 | JS; |
|
| 170 | } |
|
| 171 | ||
| 172 | if (is_a($enumFqcn, FlaggedEnum::class, true)) { |
|
| 173 | $readablesCode .= "\n\n // Named masks"; |
|
| @@ 174-184 (lines=11) @@ | ||
| 171 | ||
| 172 | if (is_a($enumFqcn, FlaggedEnum::class, true)) { |
|
| 173 | $readablesCode .= "\n\n // Named masks"; |
|
| 174 | foreach ($this->getMasks($enumFqcn) as $constant => $value) { |
|
| 175 | if (!$readable = $readables[$value] ?? false) { |
|
| 176 | continue; |
|
| 177 | } |
|
| 178 | ||
| 179 | $readablesCode .= |
|
| 180 | <<<JS |
|
| 181 | ||
| 182 | [{$shortName}.{$constant}]: '{$readable}', |
|
| 183 | JS; |
|
| 184 | } |
|
| 185 | } |
|
| 186 | ||
| 187 | // Generate readables method: |
|