QRCodeBenchmark.php 840 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Class QRCodeBenchmark
  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\QRCode;
  13. use PhpBench\Attributes\{BeforeMethods, Subject};
  14. /**
  15. * Tests the overall performance of the QRCode class
  16. */
  17. final class QRCodeBenchmark extends BenchmarkAbstract{
  18. public function initOptions():void{
  19. $options = [
  20. 'version' => $this->version->getVersionNumber(),
  21. 'eccLevel' => $this->eccLevel->getLevel(),
  22. ];
  23. $this->initQROptions($options);
  24. }
  25. #[Subject]
  26. #[BeforeMethods(['assignParams', 'generateTestData', 'initOptions'])]
  27. public function render():void{
  28. (new QRCode($this->options))->addSegment(new $this->modeFQCN($this->testData))->render();
  29. }
  30. }