setQrCodeService( empty($qrCodeService) ? $this->qrCodeServiceFactory() : $qrCodeService ); } /** * Generates a QR code data url to display inline. * * @param string $company * @param string $holder * @param string $secret * @param int $size * @param string $encoding Default to UTF-8 * * @return string */ public function getQRCodeInline( $company, $holder, $secret, $size = 200, $encoding = 'utf-8' ) { if (empty($this->getQrCodeService())) { throw new MissingQrCodeServiceException( 'You need to install a service package or assign yourself the service to be used.' ); } return $this->qrCodeService->getQRCodeInline( $this->getQRCodeUrl($company, $holder, $secret), $size, $encoding ); } /** * Service setter * * @return \PragmaRX\Google2FAQRCode\QRCode\QRCodeServiceContract */ public function getQrCodeService() { return $this->qrCodeService; } /** * Service setter * * @return self */ public function setQrCodeService($service) { $this->qrCodeService = $service; return $this; } /** * Create the QR Code service instance * * @return \PragmaRX\Google2FAQRCode\QRCode\QRCodeServiceContract */ public function qrCodeServiceFactory() { if ( class_exists('BaconQrCode\Writer') && class_exists('BaconQrCode\Renderer\ImageRenderer') ) { return new Bacon(); } if (class_exists('chillerlan\QRCode\QRCode')) { return new Chillerlan(); } return null; } }