* @copyright 2022 smiley * @license MIT */ namespace chillerlan\QRCode\Output; use function sprintf; /** * HTML output */ class QRMarkupHTML extends QRMarkup{ /** * @inheritDoc */ protected function createMarkup(bool $saveToFile):string{ $html = empty($this->options->cssClass) ? '
' : sprintf('
', $this->getCssClass(0)); // @todo $M_TYPE $html .= $this->options->eol; for($y = 0; $y < $this->moduleCount; $y++){ $html .= '
'; for($x = 0; $x < $this->moduleCount; $x++){ $html .= sprintf('', $this->getModuleValueAt($x, $y)); } $html .= '
'.$this->options->eol; } $html .= '
'.$this->options->eol; // wrap the snippet into a body when saving to file if($saveToFile){ $html = sprintf( 'QR Code%s', $this->options->eol.$html ); } return $html; } /** * @inheritDoc */ protected function getCssClass(int $M_TYPE):string{ return $this->options->cssClass; } }