2022-05-30 17:50:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Endroid\QrCode\Encoding;
|
|
|
|
|
|
|
|
final class Encoding implements EncodingInterface
|
|
|
|
{
|
2023-07-07 22:33:10 +02:00
|
|
|
public function __construct(
|
|
|
|
private string $value
|
|
|
|
) {
|
2022-05-30 17:50:46 +02:00
|
|
|
if (!in_array($value, mb_list_encodings())) {
|
|
|
|
throw new \Exception(sprintf('Invalid encoding "%s"', $value));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __toString(): string
|
|
|
|
{
|
|
|
|
return $this->value;
|
|
|
|
}
|
|
|
|
}
|