Quellcode durchsuchen

:octocat: accept the ContainerInterface instead of QROptions

codemasher vor 7 Jahren
Ursprung
Commit
0044e686ff
3 geänderte Dateien mit 16 neuen und 12 gelöschten Zeilen
  1. 4 3
      src/Data/QRDataAbstract.php
  2. 5 4
      src/Output/QROutputAbstract.php
  3. 7 5
      src/QRCode.php

+ 4 - 3
src/Data/QRDataAbstract.php

@@ -19,6 +19,7 @@ use chillerlan\QRCode\Helpers\{
 	BitBuffer, Polynomial
 	BitBuffer, Polynomial
 };
 };
 use chillerlan\Traits\ClassLoader;
 use chillerlan\Traits\ClassLoader;
+use chillerlan\Traits\ContainerInterface;
 
 
 /**
 /**
  * Processes the binary data and maps it on a matrix which is then being returned
  * Processes the binary data and maps it on a matrix which is then being returned
@@ -88,10 +89,10 @@ abstract class QRDataAbstract implements QRDataInterface{
 	/**
 	/**
 	 * QRDataInterface constructor.
 	 * QRDataInterface constructor.
 	 *
 	 *
-	 * @param \chillerlan\QRCode\QROptions $options
-	 * @param string|null                  $data
+	 * @param \chillerlan\Traits\ContainerInterface $options
+	 * @param string|null                           $data
 	 */
 	 */
-	public function __construct(QROptions $options, string $data = null){
+	public function __construct(ContainerInterface $options, string $data = null){
 		$this->options = $options;
 		$this->options = $options;
 
 
 		if($data !== null){
 		if($data !== null){

+ 5 - 4
src/Output/QROutputAbstract.php

@@ -13,8 +13,9 @@
 namespace chillerlan\QRCode\Output;
 namespace chillerlan\QRCode\Output;
 
 
 use chillerlan\QRCode\{
 use chillerlan\QRCode\{
-	Data\QRMatrix, QRCode, QROptions
+	Data\QRMatrix, QRCode
 };
 };
+use chillerlan\Traits\ContainerInterface;
 
 
 /**
 /**
  *
  *
@@ -49,10 +50,10 @@ abstract class QROutputAbstract implements QROutputInterface{
 	/**
 	/**
 	 * QROutputAbstract constructor.
 	 * QROutputAbstract constructor.
 	 *
 	 *
-	 * @param \chillerlan\QRCode\QROptions     $options
-	 * @param \chillerlan\QRCode\Data\QRMatrix $matrix
+	 * @param \chillerlan\Traits\ContainerInterface $options
+	 * @param \chillerlan\QRCode\Data\QRMatrix      $matrix
 	 */
 	 */
-	public function __construct(QROptions $options, QRMatrix $matrix){
+	public function __construct(ContainerInterface $options, QRMatrix $matrix){
 		$this->options     = $options;
 		$this->options     = $options;
 		$this->matrix      = $matrix;
 		$this->matrix      = $matrix;
 		$this->moduleCount = $this->matrix->size();
 		$this->moduleCount = $this->matrix->size();

+ 7 - 5
src/QRCode.php

@@ -18,7 +18,9 @@ use chillerlan\QRCode\Data\{
 use chillerlan\QRCode\Output\{
 use chillerlan\QRCode\Output\{
 	QRCodeOutputException, QRImage, QRMarkup, QROutputInterface, QRString
 	QRCodeOutputException, QRImage, QRMarkup, QROutputInterface, QRString
 };
 };
-use chillerlan\Traits\ClassLoader;
+use chillerlan\Traits\{
+	ClassLoader, ContainerInterface
+};
 
 
 /**
 /**
  * Turns a text string into a Model 2 QR Code
  * Turns a text string into a Model 2 QR Code
@@ -104,9 +106,9 @@ class QRCode{
 	/**
 	/**
 	 * QRCode constructor.
 	 * QRCode constructor.
 	 *
 	 *
-	 * @param \chillerlan\QRCode\QROptions|null $options
+	 * @param \chillerlan\Traits\ContainerInterface|null $options
 	 */
 	 */
-	public function __construct(QROptions $options = null){
+	public function __construct(ContainerInterface $options = null){
 		mb_internal_encoding('UTF-8');
 		mb_internal_encoding('UTF-8');
 
 
 		$this->setOptions($options ?? new QROptions);
 		$this->setOptions($options ?? new QROptions);
@@ -115,12 +117,12 @@ class QRCode{
 	/**
 	/**
 	 * Sets the options, called internally by the constructor
 	 * Sets the options, called internally by the constructor
 	 *
 	 *
-	 * @param \chillerlan\QRCode\QROptions $options
+	 * @param \chillerlan\Traits\ContainerInterface $options
 	 *
 	 *
 	 * @return \chillerlan\QRCode\QRCode
 	 * @return \chillerlan\QRCode\QRCode
 	 * @throws \chillerlan\QRCode\QRCodeException
 	 * @throws \chillerlan\QRCode\QRCodeException
 	 */
 	 */
-	public function setOptions(QROptions $options):QRCode{
+	public function setOptions(ContainerInterface $options):QRCode{
 
 
 		if(!array_key_exists($options->eccLevel, $this::ECC_MODES)){
 		if(!array_key_exists($options->eccLevel, $this::ECC_MODES)){
 			throw new QRCodeException('Invalid error correct level: '.$options->eccLevel);
 			throw new QRCodeException('Invalid error correct level: '.$options->eccLevel);