File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -23,23 +23,24 @@ class Google2FA extends Google2FAService
2323 protected $ qrCodeBackend ;
2424
2525 /**
26- * Construct the correct backend.
26+ * Get current image correct backend.
2727 */
28- protected function constructBackend ()
28+ protected function getImageBackend ()
2929 {
30+ if (!class_exists ('BaconQrCode\Renderer\ImageRenderer ' )) {
31+ return null ;
32+ }
33+
3034 switch ($ this ->getQRCodeBackend ()) {
3135 case Constants::QRCODE_IMAGE_BACKEND_SVG :
32- parent ::__construct (null , new \BaconQrCode \Renderer \Image \SvgImageBackEnd ());
33- break ;
36+ return new \BaconQrCode \Renderer \Image \SvgImageBackEnd ();
3437
3538 case Constants::QRCODE_IMAGE_BACKEND_EPS :
36- parent ::__construct (null , new \BaconQrCode \Renderer \Image \EpsImageBackEnd ());
37- break ;
39+ return new \BaconQrCode \Renderer \Image \EpsImageBackEnd ();
3840
3941 case Constants::QRCODE_IMAGE_BACKEND_IMAGEMAGICK :
4042 default :
41- parent ::__construct ();
42- break ;
43+ return null ;
4344 }
4445 }
4546
@@ -66,7 +67,7 @@ public function __construct(IlluminateRequest $request)
6667 {
6768 $ this ->boot ($ request );
6869
69- $ this ->constructBackend ( );
70+ parent :: __construct ( null , $ this ->getImageBackend () );
7071 }
7172
7273 /**
You can’t perform that action at this time.
0 commit comments