mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-18 17:38:20 +02:00
Apply Laravel Pint fixes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user