Menu

## QRMarkupSVG extends QRMarkup
in package

QRMarkupSVG.php : 24

SVG output

##### Tags

see
  https://github.com/codemasher/php-qrcode/pull/5
see
  https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg
see
  https://www.sarasoueidan.com/demos/interactive-svg-coordinate-system/
see
  http://apex.infogridpacific.com/SVG/svg-tutorial-contents.html

### Table of Contents

$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
$scale : int
  the current scaling for a QR pixel
__construct() : mixed
  QROutputAbstract constructor.
dump() : string
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
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 module)
getModuleValue() : mixed
  Returns the final value for the given input (return value depends on the output module)
header() : string
  returns the <svg> header with the given options parsed
module() : string
  returns a path segment for a single module
moduleValueIsValid() : bool
  Determines whether the given value is valid
path() : string
  renders and returns a single <path> element
paths() : string
  returns one or more SVG <path> elements
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::size()

#### $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 $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

##### Return values

mixed —

#### dump()

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

##### Parameters

$file : string = null

##### Tags

inheritDoc

##### Return values

string —

#### collectModules()

QROutputAbstract.php : 158

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

QRMarkupSVG.php : 29
`protected createMarkup(bool $saveToFile) : string`

##### Parameters

$saveToFile : bool

##### Tags

inheritDoc

##### Return values

string —

#### getCssClass()

QRMarkupSVG.php : 121

returns a string with all css classes for the current element

`protected getCssClass(int $M_TYPE) : string`

##### Parameters

$M_TYPE : int

##### Tags

inheritDoc

##### Return values

string —

#### getDefaultModuleValue()

QROutputAbstract.php : 115

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

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

##### Parameters

$isDark : bool

##### Return values

mixed —

#### getModuleValue()

QROutputAbstract.php : 108

Returns the final value for the given input (return value depends on the output module)

`protected abstract getModuleValue(mixed $value) : mixed`

##### Parameters

$value : mixed

##### Return values

mixed —

#### header()

QRMarkupSVG.php : 52

returns the <svg> header with the given options parsed

`protected header() : string`

##### Return values

string —

#### module()

QRMarkupSVG.php : 134

returns a path segment for a single module

`protected module(int $x, int $y, int $M_TYPE) : string`

##### Parameters

$x : int
$y : int
$M_TYPE : int

##### Tags

see
  https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d

##### Return values

string —

#### moduleValueIsValid()

QROutputAbstract.php : 99

Determines whether the given value is valid

`protected abstract moduleValueIsValid(mixed|null $value) : bool`

##### Parameters

$value : mixed|null

##### Return values

bool —

#### path()

QRMarkupSVG.php : 103

renders and returns a single <path> element

`protected path(string $path, int $M_TYPE) : string`

##### Parameters

$path : string
$M_TYPE : int

##### Tags

see
  https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path

##### Return values

string —

#### paths()

QRMarkupSVG.php : 72

returns one or more SVG <path> elements

`protected paths() : string`

##### Return values

string —

#### saveToFile()

QROutputAbstract.php : 132

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

##### Return values

void —

#### setMatrixDimensions()

QROutputAbstract.php : 73

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

##### Return values

void —

#### setModuleValues()

QROutputAbstract.php : 82

Sets the initial module values

`protected setModuleValues() : void`

##### Return values

void —

#### toBase64DataURI()

QROutputAbstract.php : 120

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