Skip to content

Commit 6c760c5

Browse files
committed
:octocat: QROutputInterface: add layernames
1 parent a165984 commit 6c760c5

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/Output/QRMarkupSVG.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ protected function path(string $path, int $M_TYPE):string{
144144
*/
145145
protected function getCssClass(int $M_TYPE):string{
146146
return implode(' ', [
147-
'qr-'.$M_TYPE,
147+
'qr-'.($this::LAYERNAMES[$M_TYPE] ?? $M_TYPE),
148148
(($M_TYPE & QRMatrix::IS_DARK) === QRMatrix::IS_DARK) ? 'dark' : 'light',
149149
$this->options->cssClass,
150150
]);

src/Output/QROutputInterface.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,36 @@ interface QROutputInterface{
8888
QRMatrix::M_TEST_DARK => true,
8989
];
9090

91+
/**
92+
* @var string[]
93+
*/
94+
public const LAYERNAMES = [
95+
// light
96+
QRMatrix::M_NULL => 'null',
97+
QRMatrix::M_DATA => 'data',
98+
QRMatrix::M_FINDER => 'finder',
99+
QRMatrix::M_SEPARATOR => 'separator',
100+
QRMatrix::M_ALIGNMENT => 'alignment',
101+
QRMatrix::M_TIMING => 'timing',
102+
QRMatrix::M_FORMAT => 'format',
103+
QRMatrix::M_VERSION => 'version',
104+
QRMatrix::M_QUIETZONE => 'quietzone',
105+
QRMatrix::M_LOGO => 'logo',
106+
QRMatrix::M_TEST => 'test',
107+
// dark
108+
QRMatrix::M_DARKMODULE => 'darkmodule',
109+
QRMatrix::M_DATA_DARK => 'data-dark',
110+
QRMatrix::M_FINDER_DARK => 'finder-dark',
111+
QRMatrix::M_ALIGNMENT_DARK => 'alignment-dark',
112+
QRMatrix::M_TIMING_DARK => 'timing-dark',
113+
QRMatrix::M_FORMAT_DARK => 'format-dark',
114+
QRMatrix::M_VERSION_DARK => 'version-dark',
115+
QRMatrix::M_QUIETZONE_DARK => 'quietzone-dark',
116+
QRMatrix::M_LOGO_DARK => 'logo-dark',
117+
QRMatrix::M_FINDER_DOT => 'finder-dot',
118+
QRMatrix::M_TEST_DARK => 'test-dark',
119+
];
120+
91121
/**
92122
* Determines whether the given value is valid
93123
*

0 commit comments

Comments
 (0)