for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Class QRMarkupHTML
*
* @created 06.06.2022
* @author smiley <[email protected]>
* @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)
? '<div>'
: sprintf('<div class="%s">', $this->options->cssClass);
$html .= $this->options->eol;
foreach($this->matrix->matrix() as $row){
$html .= '<div>';
foreach($row as $M_TYPE){
$html .= sprintf('<span style="background: %s;"></span>', $this->moduleValues[$M_TYPE]);
}
$html .= '</div>'.$this->options->eol;
// wrap the snippet into a body when saving to file
if($saveToFile){
$html = sprintf(
'<!DOCTYPE html><head><meta charset="UTF-8"><title>QR Code</title></head><body>%s</body>',
$this->options->eol.$html
);
return $html;