Apply Laravel Pint fixes

This commit is contained in:
Bubka
2022-11-22 15:15:52 +01:00
parent d84dd6659e
commit d6fd8e3c52
178 changed files with 2409 additions and 2899 deletions

View File

@@ -2,18 +2,18 @@
namespace App\Services;
use Zxing\QrReader;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QROptions;
use Illuminate\Support\Facades\Log;
use chillerlan\QRCode\{QRCode, QROptions};
use Zxing\QrReader;
class QrCodeService
{
/**
* Encode a string into a QR code image
*
* @param string $data The string to encode
*
* @return mixed
*
* @param string $data The string to encode
* @return mixed
*/
public static function encode(string $data)
{
@@ -29,24 +29,23 @@ class QrCodeService
return $qrcode->render($data);
}
/**
* Decode an uploaded QR code image
*
* @param \Illuminate\Http\UploadedFile $file
*
* @param \Illuminate\Http\UploadedFile $file
* @return string
*/
public static function decode(\Illuminate\Http\UploadedFile $file)
{
$qrcode = new QrReader($file->get(), QrReader::SOURCE_TYPE_BLOB);
$data = urldecode($qrcode->text());
$data = urldecode($qrcode->text());
if(!$data) {
if (! $data) {
throw new \App\Exceptions\InvalidQrCodeException;
}
Log::info('QR code decoded');
return $data;
}
}
}