* @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;
foreach($this->matrix->matrix() as $row){
$html .= '
';
foreach($row as $M_TYPE){
$html .= sprintf('', $this->moduleValues[$M_TYPE]);
}
$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;
}
}