SallaApp / ZATCA

An unofficial package maintained by Salla to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing
MIT License
137 stars 54 forks source link

Enable file save in render method #21

Closed ayaseensd closed 2 years ago

ayaseensd commented 2 years ago

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behaviour? (You can also link to an open issue here)

What is the new behaviour? (You can also link to the ticket here)

Does this PR introduce a breaking change?

ali-alharthi commented 2 years ago

Why not add another optional parameter to the render function?

public function render(array $options = [], string $file = null): string {
        $options = new QROptions($options);
        return (new QRCode($options))->render($this->toBase64(), $file ?? null);
}

I think its more IDE friendly and most importantly cleaner.

ayaseensd commented 2 years ago

@ali-alharthi I first implemented this approach, which is similar to chillerlan/php-qrcode implementation in that I intended to run render method unconditionally params order, so render($options), render($file),render($file,$options) or render($options,$file).

but I think you are right.

salkhwlani commented 2 years ago

@ayaseensd @ali-alharthi thank you for your contributions