mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-24 15:47:54 +00:00
:octocat: +QRCode::setOptions()
This commit is contained in:
+10
-2
@@ -183,12 +183,20 @@ class QRCode{
|
||||
* Sets the options instance
|
||||
*/
|
||||
public function __construct(SettingsContainerInterface $options = null){
|
||||
$this->options = $options ?? new QROptions;
|
||||
$this->setOptions($options ?? new QROptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an options instance
|
||||
*/
|
||||
public function setOptions(SettingsContainerInterface $options):self{
|
||||
$this->options = $options;
|
||||
|
||||
// I hate this less
|
||||
if($this->options->readerUseImagickIfAvailable){
|
||||
$this->luminanceSourceFQN = IMagickLuminanceSource::class;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ final class QRCodeTest extends TestCase{
|
||||
|
||||
$this->options->outputType = 'foo';
|
||||
|
||||
(new QRCode($this->options))->render('test');
|
||||
$this->qrcode->setOptions($this->options)->render('test');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ final class QRCodeTest extends TestCase{
|
||||
|
||||
$this->options->outputType = QROutputInterface::CUSTOM;
|
||||
|
||||
(new QRCode($this->options))->render('test');
|
||||
$this->qrcode->setOptions($this->options)->render('test');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ final class QRCodeTest extends TestCase{
|
||||
$this->options->outputType = QROutputInterface::CUSTOM;
|
||||
$this->options->outputInterface = stdClass::class;
|
||||
|
||||
(new QRCode($this->options))->render('test');
|
||||
$this->qrcode->setOptions($this->options)->render('test');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user