Skip to content

Commit 30248a8

Browse files
committed
address remarks made by MasterOdin
1 parent ab76ac7 commit 30248a8

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PHP library for [two-factor (or multi-factor) authentication](http://en.wikipedi
1010

1111
## Requirements
1212

13-
* Requires PHP version >8.1
13+
* Requires PHP version >=8.1
1414
* [cURL](http://php.net/manual/en/book.curl.php) when using the provided `QRServerProvider` (default), `ImageChartsQRCodeProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
1515
* [random_bytes()](http://php.net/manual/en/function.random-bytes.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.
1616

lib/Providers/Qr/BaconQrCodeProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ public function __construct(
2828
private string|array $foregroundColour = '#000000',
2929
private string $format = 'png',
3030
) {
31-
if (!class_exists(ImagickImageBackEnd::class)) {
32-
throw new RuntimeException('Make sure you are using version 2 of Bacon QR Code');
33-
}
34-
3531
$this->backgroundColour = $this->handleColour($this->backgroundColour);
3632
$this->foregroundColour = $this->handleColour($this->foregroundColour);
3733
$this->format = strtolower($this->format);

testsDependency/BaconQRCodeTest.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace TestsDependency;
66

7-
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
87
use PHPUnit\Framework\TestCase;
98
use RobThree\Auth\Algorithm;
109
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider;
@@ -18,19 +17,12 @@ class BaconQRCodeTest extends TestCase
1817

1918
public function testDependency(): void
2019
{
21-
// php < 7.1 will install an older Bacon QR Code
22-
if (!class_exists(ImagickImageBackEnd::class)) {
23-
$this->expectException(RuntimeException::class);
20+
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
2421

25-
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
26-
} else {
27-
$qr = new BaconQrCodeProvider(1, '#000', '#FFF', 'svg');
22+
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, Algorithm::Sha1, $qr);
2823

29-
$tfa = new TwoFactorAuth('Test&Issuer', 6, 30, Algorithm::Sha1, $qr);
30-
31-
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
32-
$this->assertEquals('image/svg+xml', $data['mimetype']);
33-
}
24+
$data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
25+
$this->assertEquals('image/svg+xml', $data['mimetype']);
3426
}
3527

3628
public function testBadTextColour(): void

0 commit comments

Comments
 (0)