1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- declare(strict_types=1);
- namespace Endroid\QrCode\Writer;
- use Endroid\QrCode\QrCodeInterface;
- class BinaryWriter extends AbstractWriter
- {
- public function writeString(QrCodeInterface $qrCode): string
- {
- $rows = [];
- $data = $qrCode->getData();
- foreach ($data['matrix'] as $row) {
- $values = '';
- foreach ($row as $value) {
- $values .= $value;
- }
- $rows[] = $values;
- }
- return implode("\n", $rows);
- }
- public static function getContentType(): string
- {
- return 'text/plain';
- }
- public static function getSupportedExtensions(): array
- {
- return ['bin', 'txt'];
- }
- public function getName(): string
- {
- return 'binary';
- }
- }
|