diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-07-27 10:05:23 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-07-27 10:05:23 +0200 |
| commit | 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab (patch) | |
| tree | 39a1a4629749056191c05dfd899f931701b7acf3 /srcs/phpmyadmin/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php | |
| parent | 5afd237bbd22028b85532b8c0b3fcead49a00764 (diff) | |
| download | ft_server-master.tar.gz ft_server-master.tar.bz2 ft_server-master.zip | |
Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my famillyHEADmaster
Diffstat (limited to 'srcs/phpmyadmin/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php')
| -rw-r--r-- | srcs/phpmyadmin/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/srcs/phpmyadmin/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php b/srcs/phpmyadmin/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php deleted file mode 100644 index 8aa7652..0000000 --- a/srcs/phpmyadmin/vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -declare(strict_types = 1); - -namespace BaconQrCode\Renderer; - -use BaconQrCode\Encoder\QrCode; -use BaconQrCode\Exception\InvalidArgumentException; - -final class PlainTextRenderer implements RendererInterface -{ - /** - * UTF-8 full block (U+2588) - */ - private const FULL_BLOCK = "\xe2\x96\x88"; - - /** - * UTF-8 upper half block (U+2580) - */ - private const UPPER_HALF_BLOCK = "\xe2\x96\x80"; - - /** - * UTF-8 lower half block (U+2584) - */ - private const LOWER_HALF_BLOCK = "\xe2\x96\x84"; - - /** - * UTF-8 no-break space (U+00A0) - */ - private const EMPTY_BLOCK = "\xc2\xa0"; - - /** - * @var int - */ - private $margin; - - public function __construct(int $margin = 2) - { - $this->margin = $margin; - } - - /** - * @throws InvalidArgumentException if matrix width doesn't match height - */ - public function render(QrCode $qrCode) : string - { - $matrix = $qrCode->getMatrix(); - $matrixSize = $matrix->getWidth(); - - if ($matrixSize !== $matrix->getHeight()) { - throw new InvalidArgumentException('Matrix must have the same width and height'); - } - - $rows = $matrix->getArray()->toArray(); - - if (0 !== $matrixSize % 2) { - $rows[] = array_fill(0, $matrixSize, 0); - } - - $horizontalMargin = str_repeat(self::EMPTY_BLOCK, $this->margin); - $result = str_repeat("\n", (int) ceil($this->margin / 2)); - - for ($i = 0; $i < $matrixSize; $i += 2) { - $result .= $horizontalMargin; - - $upperRow = $rows[$i]; - $lowerRow = $rows[$i + 1]; - - for ($j = 0; $j < $matrixSize; ++$j) { - $upperBit = $upperRow[$j]; - $lowerBit = $lowerRow[$j]; - - if ($upperBit) { - $result .= $lowerBit ? self::FULL_BLOCK : self::UPPER_HALF_BLOCK; - } else { - $result .= $lowerBit ? self::LOWER_HALF_BLOCK : self::EMPTY_BLOCK; - } - } - - $result .= $horizontalMargin . "\n"; - } - - $result .= str_repeat("\n", (int) ceil($this->margin / 2)); - - return $result; - } -} |
