Skip to content

Commit

Permalink
Move createWriterRegistry to constructor of QrCode
Browse files Browse the repository at this point in the history
  • Loading branch information
sprain committed Feb 2, 2019
1 parent a70a1d7 commit 2decad9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/QrCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public function __construct(string $text = '')

$this->errorCorrectionLevel = new ErrorCorrectionLevel(ErrorCorrectionLevel::LOW);
$this->labelAlignment = new LabelAlignment(LabelAlignment::CENTER);

$this->createWriterRegistry();
}

public function setText(string $text): void
Expand Down Expand Up @@ -285,10 +287,6 @@ public function setWriter(WriterInterface $writer): void

public function getWriter(string $name = null): WriterInterface
{
if (!$this->writerRegistry instanceof WriterRegistryInterface) {
$this->createWriterRegistry();
}

if (!is_null($name)) {
return $this->writerRegistry->getWriter($name);
}
Expand Down

0 comments on commit 2decad9

Please sign in to comment.