Debian Codegraph @

vendor/endroid/qr-code/src/Writer/Result/BinaryResult.php

raw
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Endroid\QrCode\Writer\Result;
6
7 use Endroid\QrCode\Matrix\MatrixInterface;
8
9 final class BinaryResult extends AbstractResult
10 {
11 public function __construct(MatrixInterface $matrix)
12 {
13 parent::__construct($matrix);
14 }
15
16 public function getString(): string
17 {
18 $matrix = $this->getMatrix();
19
20 $binaryString = '';
21 for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
22 for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
23 $binaryString .= $matrix->getBlockValue($rowIndex, $columnIndex);
24 }
25 $binaryString .= "\n";
26 }
27
28 return $binaryString;
29 }
30
31 public function getMimeType(): string
32 {
33 return 'text/plain';
34 }
35 }