PHP Class SimpleSoftwareIO\QrCode\BaconQrCodeGenerator

Inheritance: implements SimpleSoftwareIO\QrCode\QrCodeInterface
Exibir arquivo Open project: simplesoftwareio/simple-qrcode Class Usage Examples

Protected Properties

Property Type Description
$encoding string Holds the Encoder mode to encode a QrCode.
$errorCorrection BaconQrCode\Common\ErrorCorrectionLevel Holds the QrCode error correction levels. This is stored by using the BaconQrCode ErrorCorrectionLevel class constants.
$imageMerge null | string Holds an image string that will be merged with the QrCode.
$imagePercentage float The percentage that a merged image should take over the source image.
$writer BaconQrCode\Writer Holds the BaconQrCode Writer Object.

Public Methods

Method Description
__call ( $method, $arguments ) Creates a new datatype object and then generates a QrCode.
__construct ( BaconQrCode\Writer $writer = null, BaconQrCode\Renderer\Image\RendererInterface $format = null ) Creates a new QrCodeGenerator with a Writer class and with a SVG renderer set as the default.
backgroundColor ( integer $red, integer $green, integer $blue ) Changes the background color of a QrCode.
color ( integer $red, integer $green, integer $blue ) Changes the foreground color of a QrCode.
encoding ( string $encoding ) Sets the Encoding mode.
errorCorrection ( string $level ) Changes the error correction level of a QrCode.
format ( string $format ) Switches the format of the outputted QrCode or defaults to SVG.
generate ( string $text, null | string $filename = null ) : string | void Generates a QrCode.
margin ( integer $margin ) Creates a margin around the QrCode.
merge ( $filepath, $percentage = 0.2, $absolute = false ) Merges an image with the center of the QrCode.
mergeString ( $content, $percentage = 0.2 ) Merges an image string with the center of the QrCode, does not check for correct format.
size ( integer $pixels ) Changes the size of the QrCode.

Private Methods

Method Description
createClass ( string $method ) : SimpleSoftwareIO\QrCode\DataTypes\DataTypeInterface Creates a new DataType class dynamically.
formatClass ( $method ) : string Formats the method name correctly.

Method Details

__call() public method

Creates a new datatype object and then generates a QrCode.
public __call ( $method, $arguments )
$method
$arguments

__construct() public method

Creates a new QrCodeGenerator with a Writer class and with a SVG renderer set as the default.
public __construct ( BaconQrCode\Writer $writer = null, BaconQrCode\Renderer\Image\RendererInterface $format = null )
$writer BaconQrCode\Writer
$format BaconQrCode\Renderer\Image\RendererInterface

backgroundColor() public method

Changes the background color of a QrCode.
public backgroundColor ( integer $red, integer $green, integer $blue )
$red integer
$green integer
$blue integer

color() public method

Changes the foreground color of a QrCode.
public color ( integer $red, integer $green, integer $blue )
$red integer
$green integer
$blue integer

encoding() public method

Sets the Encoding mode.
public encoding ( string $encoding )
$encoding string

errorCorrection() public method

Changes the error correction level of a QrCode.
public errorCorrection ( string $level )
$level string Desired error correction level. L = 7% M = 15% Q = 25% H = 30%

format() public method

Switches the format of the outputted QrCode or defaults to SVG.
public format ( string $format )
$format string The desired format.

generate() public method

Generates a QrCode.
public generate ( string $text, null | string $filename = null ) : string | void
$text string The text to be converted into a QrCode
$filename null | string The filename and path to save the QrCode file
return string | void Returns a QrCode string depending on the format, or saves to a file.

margin() public method

Creates a margin around the QrCode.
public margin ( integer $margin )
$margin integer The desired margin in pixels around the QrCode

merge() public method

Merges an image with the center of the QrCode.
public merge ( $filepath, $percentage = 0.2, $absolute = false )
$filepath string The filepath to an image
$percentage float The amount that the merged image should be placed over the qrcode.
$absolute boolean Whether to use an absolute filepath or not.

mergeString() public method

Merges an image string with the center of the QrCode, does not check for correct format.
public mergeString ( $content, $percentage = 0.2 )
$content string The string contents of an image.
$percentage float The amount that the merged image should be placed over the qrcode.

size() public method

Changes the size of the QrCode.
public size ( integer $pixels )
$pixels integer The size of the QrCode in pixels

Property Details

$encoding protected_oe property

Holds the Encoder mode to encode a QrCode.
protected string $encoding
return string

$errorCorrection protected_oe property

Holds the QrCode error correction levels. This is stored by using the BaconQrCode ErrorCorrectionLevel class constants.
protected ErrorCorrectionLevel,BaconQrCode\Common $errorCorrection
return BaconQrCode\Common\ErrorCorrectionLevel

$imageMerge protected_oe property

Holds an image string that will be merged with the QrCode.
protected null|string $imageMerge
return null | string

$imagePercentage protected_oe property

The percentage that a merged image should take over the source image.
protected float $imagePercentage
return float

$writer protected_oe property

Holds the BaconQrCode Writer Object.
protected Writer,BaconQrCode $writer
return BaconQrCode\Writer