Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/vendor/bacon/bacon-qr-code/src/Common/ |
Upload File : |
<?php declare(strict_types = 1); namespace BaconQrCode\Common; use BaconQrCode\Exception\OutOfBoundsException; use DASPRiD\Enum\AbstractEnum; /** * Enum representing the four error correction levels. * * @method static self L() ~7% correction * @method static self M() ~15% correction * @method static self Q() ~25% correction * @method static self H() ~30% correction */ final class ErrorCorrectionLevel extends AbstractEnum { protected const L = [0x01]; protected const M = [0x00]; protected const Q = [0x03]; protected const H = [0x02]; protected function __construct(private readonly int $bits) { } /** * @throws OutOfBoundsException if number of bits is invalid */ public static function forBits(int $bits) : self { switch ($bits) { case 0: return self::M(); case 1: return self::L(); case 2: return self::H(); case 3: return self::Q(); } throw new OutOfBoundsException('Invalid number of bits'); } /** * Returns the two bits used to encode this error correction level. */ public function getBits() : int { return $this->bits; } }