# Documentation

Menu

## QRMarkup extends QROutputAbstract
in package

AbstractYes
QRMarkup.php : 18

Abstract for markup types: HTML, SVG, ... XML anyone?

### Table of Contents

#### Properties

$length : int
  the side length of the QR image (modules * scale)
$matrix : QRMatrix
  the (filled) data matrix object
$moduleCount : int
  the current size of the QR matrix
$moduleValues : array<string|int, mixed>
  an (optional) array of color values for the several QR matrix parts
$options : SettingsContainerInterface|QROptions
$scale : int
  the current scaling for a QR pixel

#### Methods

__construct() : mixed
  QROutputAbstract constructor.
dump() : string
moduleValueIsValid() : bool
  note: we're not necessarily validating the several values, just checking the general syntax note: css4 colors are not included
collectModules() : array<string|int, mixed>
  collects the modules per QRMatrix::M_* type and runs a $transform function on each module and returns an array with the transformed modules
createMarkup() : string
  returns the fully parsed and rendered markup string for the given input
getCssClass() : string
  returns a string with all css classes for the current element
getDefaultModuleValue() : mixed|null
  Returns a default value for either dark or light modules
getModuleValue() : mixed|null
  Returns the prepared value for the given $M_TYPE
getModuleValueAt() : mixed|null
  Returns the prepared module value at the given coordinate [$x, $y] (convenience)
getOutputDimensions() : array<string|int, mixed>
  Returns a 2 element array with the current output width and height
prepareModuleValue() : mixed|null
  Prepares the value for the given input ()
saveToFile() : void
  Saves the qr $data to a $file. If $file is null, nothing happens.
setMatrixDimensions() : void
  Sets/updates the matrix dimensions
setModuleValues() : void
  Sets the initial module values
toBase64DataURI() : string
  Returns a base64 data URI for the given string and mime type

### Properties

#### $length

QROutputAbstract.php : 40

the side length of the QR image (modules * scale)

`protected int $length`

#### $matrix

QROutputAbstract.php : 50

the (filled) data matrix object

`protected QRMatrix $matrix`

#### $moduleCount

QROutputAbstract.php : 28

the current size of the QR matrix

`protected int $moduleCount`

##### Tags

see
  QRMatrix::getSize()

#### $moduleValues

QROutputAbstract.php : 45

an (optional) array of color values for the several QR matrix parts

`protected array<string|int, mixed> $moduleValues`

#### $options

QROutputAbstract.php : 55
`protected SettingsContainerInterface|QROptions $options`

#### $scale

QROutputAbstract.php : 35

the current scaling for a QR pixel

`protected int $scale`

##### Tags

see
  QROptions::$scale

### Methods

#### __construct()

QROutputAbstract.php : 60

QROutputAbstract constructor.

`public __construct(SettingsContainerInterface $options, QRMatrix $matrix) : mixed`

##### Parameters

$options : SettingsContainerInterface
$matrix : QRMatrix

#### dump()

QRMarkup.php : 74
`public dump([string $file = null ]) : string`

##### Parameters

$file : string = null

##### Tags

inheritDoc

##### Return values

string

#### moduleValueIsValid()

QRMarkup.php : 29

note: we're not necessarily validating the several values, just checking the general syntax note: css4 colors are not included

`public static moduleValueIsValid(mixed $value) : bool`

##### Parameters

$value : mixed

##### Tags

todo:

  XSS proof

see
  https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
inheritDoc

##### Return values

bool

#### collectModules()

QROutputAbstract.php : 189

collects the modules per QRMatrix::M_* type and runs a $transform function on each module and returns an array with the transformed modules

`protected collectModules(Closure $transform) : array<string|int, mixed>`

The transform callback is called with the following parameters:

$x - current column $y - current row $M_TYPE - field value $M_TYPE_LAYER - (possibly modified) field value that acts as layer id

##### Parameters

$transform : Closure

##### Return values

array<string|int, mixed>

#### createMarkup()

QRMarkup.php : 92

returns the fully parsed and rendered markup string for the given input

`protected abstract createMarkup(bool $saveToFile) : string`

##### Parameters

$saveToFile : bool

##### Return values

string

#### getCssClass()

QRMarkup.php : 85

returns a string with all css classes for the current element

`protected getCssClass([int $M_TYPE = 0 ]) : string`

##### Parameters

$M_TYPE : int = 0

##### Return values

string

#### getDefaultModuleValue()

QRMarkup.php : 67

Returns a default value for either dark or light modules

`protected getDefaultModuleValue(bool $isDark) : mixed|null`

##### Parameters

$isDark : bool

##### Tags

inheritDoc

##### Return values

mixed|null —

return value depends on the output class

#### getModuleValue()

QROutputAbstract.php : 113

Returns the prepared value for the given $M_TYPE

`protected getModuleValue(int $M_TYPE) : mixed|null`

##### Parameters

$M_TYPE : int

##### Tags

throws
  QRCodeOutputException

##### Return values

mixed|null —

return value depends on the output class, null if $moduleValues[$M_TYPE] doesn't exist

#### getModuleValueAt()

QROutputAbstract.php : 128

Returns the prepared module value at the given coordinate [$x, $y] (convenience)

`protected getModuleValueAt(int $x, int $y) : mixed|null`

##### Parameters

$x : int
$y : int

##### Return values

mixed|null

#### getOutputDimensions()

QROutputAbstract.php : 88

Returns a 2 element array with the current output width and height

`protected getOutputDimensions() : array<string|int, mixed>`

The type and units of the values depend on the output class. The default value is the current module count * scale.

##### Return values

array<string|int, mixed>

#### prepareModuleValue()

QRMarkup.php : 60

Prepares the value for the given input ()

`protected prepareModuleValue(mixed $value) : mixed|null`

##### Parameters

$value : mixed

##### Tags

inheritDoc

##### Return values

mixed|null —

return value depends on the output class

#### saveToFile()

QROutputAbstract.php : 163

Saves the qr $data to a $file. If $file is null, nothing happens.

`protected saveToFile(string $data[, string $file = null ]) : void`

##### Parameters

$data : string
$file : string = null

##### Tags

see
  file_put_contents()
see
  QROptions::$cachefile
throws
  QRCodeOutputException

#### setMatrixDimensions()

QROutputAbstract.php : 77

Sets/updates the matrix dimensions

`protected setMatrixDimensions() : void`

Call this method if you modify the matrix from within your custom module in case the dimensions have been changed

#### setModuleValues()

QROutputAbstract.php : 95

Sets the initial module values

`protected setModuleValues() : void`

#### toBase64DataURI()

QROutputAbstract.php : 151

Returns a base64 data URI for the given string and mime type

`protected toBase64DataURI(string $data, string $mime) : string`

##### Parameters

$data : string
$mime : string

##### Return values

string

## Search results