ErrorCorrectionLevel.php 888 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * (c) Jeroen van den Enden <info@endroid.nl>
  5. *
  6. * This source file is subject to the MIT license that is bundled
  7. * with this source code in the file LICENSE.
  8. */
  9. namespace Endroid\QrCode;
  10. use BaconQrCode\Common\ErrorCorrectionLevel as BaconErrorCorrectionLevel;
  11. use MyCLabs\Enum\Enum;
  12. /**
  13. * @method static ErrorCorrectionLevel LOW()
  14. * @method static ErrorCorrectionLevel MEDIUM()
  15. * @method static ErrorCorrectionLevel QUARTILE()
  16. * @method static ErrorCorrectionLevel HIGH()
  17. */
  18. class ErrorCorrectionLevel extends Enum
  19. {
  20. const LOW = 'low';
  21. const MEDIUM = 'medium';
  22. const QUARTILE = 'quartile';
  23. const HIGH = 'high';
  24. public function toBaconErrorCorrectionLevel(): BaconErrorCorrectionLevel
  25. {
  26. $name = strtoupper(substr($this->getValue(), 0, 1));
  27. return BaconErrorCorrectionLevel::valueOf($name);
  28. }
  29. }