Documentation

QRMarkupXML extends QRMarkup
in package

XML/XSLT output

Table of Contents

Constants

MIME_TYPE  = 'application/xml'
SCHEMA  = 'https://raw.githubusercontent.com/chillerlan/php-qrcode/main/src/Output/qrcode.schema.xsd'

Properties

$circleDiameter  : float
$circleRadius  : float
$connectPaths  : bool
$dom  : DOMDocument
$drawCircularModules  : bool
$drawLightModules  : bool
$eol  : string
$excludeFromConnect  : array<string|int, mixed>
$keepAsSquare  : array<string|int, mixed>
$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
the options instance
$scale  : int

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
copyVars()  : void
Creates copies of several QROptions values to avoid calling the magic getters in long loops for a significant performance increase.
createMarkup()  : string
returns the fully parsed and rendered markup string for the given input
createMatrix()  : DOMElement
Creates the matrix element
getCssClass()  : string
returns a string with all css classes for the current element
getDefaultModuleValue()  : mixed
Returns a default value for either dark or light modules (return value depends on the output class)
getModuleValue()  : mixed
Returns the prepared value for the given $M_TYPE
getModuleValueAt()  : mixed
Returns the prepared module value at the given coordinate [$x, $y] (convenience)
getOutputDimensions()  : array<string|int, mixed>
module()  : DOMElement|null
Creates a DOM element for a single module
prepareModuleValue()  : mixed
Prepares the value for the given input (return value depends on the output class)
row()  : DOMElement|null
Creates a DOM element for a matrix row
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

Constants

MIME_TYPE

public final mixed MIME_TYPE = 'application/xml'

SCHEMA

public final mixed SCHEMA = 'https://raw.githubusercontent.com/chillerlan/php-qrcode/main/src/Output/qrcode.schema.xsd'

Properties

$circleRadius

protected float $circleRadius
Tags
see
QROptions::$circleRadius

$connectPaths

protected bool $connectPaths
Tags
see
QROptions::$connectPaths

$drawCircularModules

protected bool $drawCircularModules
Tags
see
QROptions::$drawCircularModules

$drawLightModules

protected bool $drawLightModules
Tags
see
QROptions::$drawLightModules

$excludeFromConnect

protected array<string|int, mixed> $excludeFromConnect
Tags
see
QROptions::$excludeFromConnect

$keepAsSquare

protected array<string|int, mixed> $keepAsSquare
Tags
see
QROptions::$keepAsSquare

$length

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

protected int $length

$moduleValues

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

protected array<string|int, mixed> $moduleValues

Methods

dump()

public dump([string $file = null ]) : string
Parameters
$file : string = null
Tags
inheritDoc
Return values
string

moduleValueIsValid()

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
implements

\chillerlan\QRCode\Output\QROutputInterface::moduleValueIsValid()

inheritDoc
Return values
bool

collectModules()

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>

copyVars()

Creates copies of several QROptions values to avoid calling the magic getters in long loops for a significant performance increase.

protected copyVars() : void

These variables are usually used in the "module" methods and are called up to 31329 times (at version 40).

createMarkup()

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

protected createMarkup(bool $saveToFile) : string
Parameters
$saveToFile : bool
Tags
inheritDoc
Return values
string

createMatrix()

Creates the matrix element

protected createMatrix() : DOMElement
Return values
DOMElement

getCssClass()

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()

Returns a default value for either dark or light modules (return value depends on the output class)

protected abstract getDefaultModuleValue(bool $isDark) : mixed
Parameters
$isDark : bool

getModuleValue()

Returns the prepared value for the given $M_TYPE

protected getModuleValue(int $M_TYPE) : mixed
Parameters
$M_TYPE : int
Tags
throws
QRCodeOutputException

if $moduleValues[$M_TYPE] doesn't exist

getModuleValueAt()

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

protected getModuleValueAt(int $x, int $y) : mixed
Parameters
$x : int
$y : int

getOutputDimensions()

protected getOutputDimensions() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

module()

Creates a DOM element for a single module

protected module(int $x, int $y, int $M_TYPE) : DOMElement|null
Parameters
$x : int
$y : int
$M_TYPE : int
Return values
DOMElement|null

prepareModuleValue()

Prepares the value for the given input (return value depends on the output class)

protected abstract prepareModuleValue(mixed $value) : mixed
Parameters
$value : mixed

row()

Creates a DOM element for a matrix row

protected row(int $y, array<string|int, mixed> $row) : DOMElement|null
Parameters
$y : int
$row : array<string|int, mixed>
Return values
DOMElement|null

saveToFile()

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()

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()

Sets the initial module values

protected setModuleValues() : void

toBase64DataURI()

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

protected toBase64DataURI(string $data[, string $mime = null ]) : string
Parameters
$data : string
$mime : string = null
Return values
string

        
On this page

Search results