MaskPatternBenchmark.php 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Class MaskPatternBenchmark
  4. *
  5. * @created 23.04.2024
  6. * @author smiley <smiley@chillerlan.net>
  7. * @copyright 2024 smiley
  8. * @license MIT
  9. */
  10. declare(strict_types=1);
  11. namespace chillerlan\QRCodeBenchmark;
  12. use chillerlan\QRCode\Common\{MaskPattern, Mode};
  13. use chillerlan\QRCode\Data\Byte;
  14. use PhpBench\Attributes\{BeforeMethods, Subject};
  15. /**
  16. * Tests the performance of the mask pattern penalty testing
  17. */
  18. final class MaskPatternBenchmark extends BenchmarkAbstract{
  19. protected const DATAMODES = [Mode::BYTE => Byte::class];
  20. public function initOptions():void{
  21. $options = [
  22. 'version' => $this->version->getVersionNumber(),
  23. 'eccLevel' => $this->eccLevel->getLevel(),
  24. ];
  25. $this->initQROptions($options);
  26. }
  27. #[Subject]
  28. #[BeforeMethods(['assignParams', 'generateTestData', 'initOptions', 'initMatrix'])]
  29. public function getBestPattern():void{
  30. MaskPattern::getBestPattern($this->matrix);
  31. }
  32. }