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