/
var
/
www
/
vhosts
/
nabawater
/
vendor
/
salla
/
zatca
/
src
/
/var/www/vhosts/nabawater/vendor/salla/zatca/src
mkdir
upload
Name
Size
Mode
Actions
Tags/
-
0755
rm
GenerateQrCode.php
1775
0644
edit
dl
rm
Tag.php
1211
0644
edit
dl
rm
Edit:
/var/www/vhosts/nabawater/vendor/salla/zatca/src/GenerateQrCode.php
(1775B)
<?php namespace Salla\ZATCA; use chillerlan\QRCode\QRCode; use InvalidArgumentException; class GenerateQrCode { /** * @var Tag|Tag[] $data The data or list of tags */ protected $data = []; /** * @param Tag|Tag[] $data The data or list of tags * * @throws InvalidArgumentException If the TLV data structure * contains other data than arrays and Tag instances. */ private function __construct($data) { $this->data = array_filter($data, function ($tag) { return $tag instanceof Tag; }); if (\count($this->data) === 0) { throw new InvalidArgumentException('malformed data structure'); } } /** * Initial the generator from list of tags. * * @param Tag[] $data The list of tags * * @return GenerateQrCode */ public static function fromArray(array $data): GenerateQrCode { return new self($data); } /** * Encodes an TLV data structure. * * @return string Returns a string representing the encoded TLV data structure. */ public function toTLV(): string { return implode('', array_map(function ($tag) { return (string) $tag; }, $this->data)); } /** * Encodes an TLV as base64 * * @return string Returns the TLV as base64 encode. */ public function toBase64(): string { return base64_encode($this->toTLV()); } /** * Render the QR code as base64 data image. * * @return string */ public function render(): string { return (new QRCode)->render($this->toBase64()); } }
Save
cmd:
run