:octocat: inject QRDataModeInterface

This commit is contained in:
codemasher
2021-01-19 20:10:12 +01:00
parent 0a1ceecdd8
commit abf6c2fd94
8 changed files with 41 additions and 35 deletions
+3 -8
View File
@@ -60,8 +60,8 @@ final class QRData{
/**
* QRData constructor.
*
* @param \chillerlan\Settings\SettingsContainerInterface $options
* @param array|null $dataSegments
* @param \chillerlan\Settings\SettingsContainerInterface $options
* @param \chillerlan\QRCode\Data\QRDataModeInterface[]|null $dataSegments
*/
public function __construct(SettingsContainerInterface $options, array $dataSegments = null){
$this->options = $options;
@@ -79,12 +79,7 @@ final class QRData{
* Sets the data string (internally called by the constructor)
*/
public function setData(array $dataSegments):QRData{
foreach($dataSegments as $segment){
[$class, $data] = $segment;
$this->dataSegments[] = new $class($data);
}
$this->dataSegments = $dataSegments;
$version = $this->options->version === QRCode::VERSION_AUTO
? $this->getMinimumVersion()