AbstractWriter.php
3 years ago
BinaryWriter.php
3 years ago
DebugWriter.php
3 years ago
EpsWriter.php
3 years ago
FpdfWriter.php
3 years ago
PngWriter.php
3 years ago
SvgWriter.php
3 years ago
WriterInterface.php
3 years ago
BinaryWriter.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | /* |
| 5 | * (c) Jeroen van den Enden <info@endroid.nl> |
| 6 | * |
| 7 | * This source file is subject to the MIT license that is bundled |
| 8 | * with this source code in the file LICENSE. |
| 9 | */ |
| 10 | namespace WP2FA_Vendor\Endroid\QrCode\Writer; |
| 11 | |
| 12 | use WP2FA_Vendor\Endroid\QrCode\QrCodeInterface; |
| 13 | class BinaryWriter extends AbstractWriter |
| 14 | { |
| 15 | public function writeString(QrCodeInterface $qrCode) : string |
| 16 | { |
| 17 | $rows = []; |
| 18 | $data = $qrCode->getData(); |
| 19 | foreach ($data['matrix'] as $row) { |
| 20 | $values = ''; |
| 21 | foreach ($row as $value) { |
| 22 | $values .= $value; |
| 23 | } |
| 24 | $rows[] = $values; |
| 25 | } |
| 26 | return \implode("\n", $rows); |
| 27 | } |
| 28 | public static function getContentType() : string |
| 29 | { |
| 30 | return 'text/plain'; |
| 31 | } |
| 32 | public static function getSupportedExtensions() : array |
| 33 | { |
| 34 | return ['bin', 'txt']; |
| 35 | } |
| 36 | public function getName() : string |
| 37 | { |
| 38 | return 'binary'; |
| 39 | } |
| 40 | } |
| 41 |