*/ enum encoding: string { case ascii = 'ASCII'; case cp1251 = 'CP1251'; // Windows 1251 case cp1252 = 'CP1252'; // Windows-1252 case cp1253 = 'CP1253'; // Windows-1253 case cp1254 = 'CP1254'; // Windows-1254 case cp1255 = 'CP1255'; // Windows-1255 case cp1256 = 'CP1256'; // Windows-1256 case cp1257 = 'CP1257'; // Windows-1257 case cp1258 = 'CP1258'; // Windows-1258 case utf8 = 'UTF-8'; case utf16 = 'UTF-16'; case utf32 = 'UTF-32'; /** * Length * * @return int Number of bits for a symbol */ public function maximum(): int { // Exit (success) return match ($this) { encoding::ascii => 7, encoding::cp1251, encoding::cp1252, encoding::cp1253, encoding::cp1254, encoding::cp1255, encoding::cp1256, encoding::cp1257, encoding::cp1258 => 8, encoding::utf8 => 8, encoding::utf16 => 16, encoding::utf32 => 32, default => throw new exception_unexpected_value('Not found the encoding') }; } }