/var/www/vhosts/nabawater/vendor/salla/zatca/src
Edit: /var/www/vhosts/nabawater/vendor/salla/zatca/src/GenerateQrCode.php (1775B)
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());
}
}