Barcode/Object/ObjectAbstract.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Barcode  
Subpackage
Object  
Version
$Id$  

\Zend_Barcode_Object_ObjectAbstract

Package: Zend_Barcode
Class for generate Barcode
Children
\Zend_Barcode_Object_Code25
\Zend_Barcode_Object_Code39
\Zend_Barcode_Object_Error
\Zend_Barcode_Object_Postnet
\Zend_Barcode_Object_Code128
\Zend_Barcode_Object_Royalmail
\Zend_Barcode_Object_Ean13
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedvoid $_addLeadingZeros = true
Activate automatic addition of leading zeros if barcode length is fixed
Default valuetrueDetails
Type
n/a
>VPropertyprotectedinteger $_backgroundColor = 16777215
Background color of the object
Default value16777215Details
Type
integer
>VPropertyprotectedinteger $_barHeight = 50
Height of the bar
Default value50Details
Type
integer
>VPropertyprotectedinteger $_barThickWidth = 3
Width of a thick bar
Default value3Details
Type
integer
>VPropertyprotectedinteger $_barThinWidth = 1
Width of a thin bar
Default value1Details
Type
integer
>VPropertyprotectedvoid $_barcodeLength = null
Fix barcode length (numeric or string like 'even')
Default valuenullDetails
Type
n/a
>VPropertyprotectedstring $_barcodeNamespace = 'Zend_Barcode_Object'
Namespace of the barcode for autoloading
Default value'Zend_Barcode_Object'Details
Type
string
>VPropertyprotectedboolean $_drawText = true
Display (or not) human readable text
Default valuetrueDetails
Type
boolean
>VPropertyprotectedinteger $_factor = 1
Factor to multiply bar and font measure (barHeight, barThinWidth, barThickWidth & fontSize)
Default value1Details
Type
integer
>VPropertyprotectedinteger|string $_font = null
Font resource - integer (1 to 5): corresponds to GD included fonts - string: corresponds to path of a TTF font
Default valuenullDetails
Type
integer | string
>VPropertyprotectedfloat $_fontSize = 10
Font size
Default value10Details
Type
float
>VPropertyprotectedinteger $_foreColor = 0
Font and bars color of the object
Default value0Details
Type
integer
>VPropertyprotectedinteger $_height = null
Height of the object
Default valuenullDetails
Type
integer
>VPropertyprotectedarray $_instructions = array()
Set of drawing instructions
Default valuearray()Details
Type
array
>VPropertyprotectedvoid $_mandatoryChecksum = false
Activation of mandatory checksum to deactivate unauthorized modification
Default valuefalseDetails
Type
n/a
>VPropertyprotectedboolean $_mandatoryQuietZones = false
Force quiet zones even if
Default valuefalseDetails
Type
boolean
>VPropertyprotectedinteger $_offsetLeft = null
Offset from the left the object (calculated from the orientation)
Default valuenullDetails
Type
integer
>VPropertyprotectedinteger $_offsetTop = null
Offset from the top the object (calculated from the orientation)
Default valuenullDetails
Type
integer
>VPropertyprotectedfloat $_orientation = 0
Orientation of the barcode in degrees
Default value0Details
Type
float
>VPropertyprotectedstring $_staticFont = null
static
TTF font name: can be set before instanciation of the object
Default valuenullDetails
Type
string
>VPropertyprotectedboolean $_stretchText = false
Adjust (or not) position of human readable characters with barcode
Default valuefalseDetails
Type
boolean
>VPropertyprotectedvoid $_substituteChecksumCharacter = 0
Character used to substitute checksum character for validation
Default value0Details
Type
n/a
>VPropertyprotectedstring $_text = null
Text to display
Default valuenullDetails
Type
string
>VPropertyprotectedstring $_type = null
Barcode type
Default valuenullDetails
Type
string
>VPropertyprotectedinteger $_width = null
Width of the object
Default valuenullDetails
Type
integer
>VPropertyprotectedboolean $_withBorder = false
Activate/deactivate border of the object
Default valuefalseDetails
Type
boolean
>VPropertyprotectedboolean $_withChecksum = false
Drawing of checksum
Default valuefalseDetails
Type
boolean
>VPropertyprotectedboolean $_withChecksumInText = false
Drawing of checksum inside text
Default valuefalseDetails
Type
boolean
>VPropertyprotectedboolean $_withQuietZones = true
Activate/deactivate drawing of quiet zones
Default valuetrueDetails
Type
boolean

Methods

methodpublic__construct(array | \Zend_Config $options = null) : void

Constructor

Parameters
NameTypeDescription
$optionsarray | \Zend_Config
methodprotected_addInstruction(array $instruction) : void

Add an instruction in the array of instructions

Parameters
NameTypeDescription
$instructionarray
methodprotected_addLeadingZeros(string $text, boolean $withoutChecksum = false) : void

Automatically add leading zeros if barcode length is fixed

Parameters
NameTypeDescription
$textstring
$withoutChecksumboolean
methodprotected_addPolygon(array $points, integer $color = null, boolean $filled = true) : void

Add a polygon drawing instruction in the set of instructions

Parameters
NameTypeDescription
$pointsarray
$colorinteger
$filledboolean
methodprotected_addText(string $text, float $size, array $position, string $font, integer $color, string $alignment = 'center', float $orientation = 0) : void

Add a text drawing instruction in the set of instructions

Parameters
NameTypeDescription
$textstring
$sizefloat
$positionarray
$fontstring
$colorinteger
$alignmentstring
$orientationfloat
methodprotected_calculateBarcodeHeight() : integer

Height of the barcode

Returns
TypeDescription
integer
methodprotected_calculateBarcodeWidth() : integer
abstract

Calculate the width of the barcode

Returns
TypeDescription
integer
methodprotected_calculateHeight() : integer

Height of the result object

Returns
TypeDescription
integer
methodprotected_calculateWidth() : integer

Width of the result image (before any rotation)

Returns
TypeDescription
integer
methodprotected_checkFontAndOrientation() : void

Drawing with an angle is just allow TTF font

Details
Throw
 
methodprotected_checkParams() : void
abstract

Checking of parameters after all settings

methodprotected_checkRatio(integer $min = 2, integer $max = 3) : void

Check the ratio between the thick and the thin bar

Parameters
NameTypeDescription
$mininteger
$maxinteger
Details
Throw
 
methodprotected_checkText( $value = null) : void

Check if a text is really provided to barcode

Parameters
NameTypeDescription
$value
Details
Throw
 
methodprotected_drawBarcode() : void

Draw the barcode

methodprotected_drawBorder() : void

Partial function to draw border

methodprotected_drawText() : void

Partial function to draw text

methodprotected_getDefaultOptions() : void

Set default options for particular object

methodprotected_postDrawBarcode() : void

Allow each child to draw something else (ex: bearer bars in interleaved 2 of 5 code)

methodprotected_preDrawBarcode() : void

Allow each child to draw something else

methodprotected_prepareBarcode() : array
abstract

Each child must prepare the barcode and return a table like array( 0 => array( 0 => int (visible(black) or not(white)) 1 => int (width of the bar) 2 => float (0->1 position from the top of the beginning of the bar in %) 3 => float (0->1 position from the top of the end of the bar in %) ), 1 => .

.. )
Returns
TypeDescription
array
methodprotected_rotate(float $x1, float $y1) : array

Apply rotation on a point in X/Y dimensions

Parameters
NameTypeDescription
$x1float

x-position before rotation

$y1float

y-position before rotation

Returns
TypeDescription
arrayArray of two elements corresponding to the new XY point
methodprotected_validateText(string $value, array $options = array()) : void

Standard validation for most of barcode objects

Parameters
NameTypeDescription
$valuestring
$optionsarray
methodpubliccheckParams() : void

Checking of parameters after all settings

methodpublicdraw() : array

Complete drawing of the barcode

Returns
TypeDescription
arrayTable of instructions
methodpublicgetBackgroundColor() : integer

Retrieve background color of the image

Returns
TypeDescription
integer
methodpublicgetBarHeight() : integer

Get height of the barcode bar

Returns
TypeDescription
integer
methodpublicgetBarThickWidth() : integer

Get thickness of thick bar

Returns
TypeDescription
integer
methodpublicgetBarThinWidth() : integer

Get thickness of thin bar

Returns
TypeDescription
integer
methodpublicgetBarcodeNamespace() : string

Retrieve barcode namespace

Returns
TypeDescription
string
methodpublicgetDrawText() : boolean

Retrieve if drawing of text to encode is enabled

Returns
TypeDescription
boolean
methodpublicgetFactor() : integer

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

Returns
TypeDescription
integer
methodpublicgetFont() : integer | string

Retrieve the font

Returns
TypeDescription
integer | string
methodpublicgetFontSize() : float

Retrieve the size of the font in case of TTF

Returns
TypeDescription
float
methodpublicgetForeColor() : \unknown

Retrieve color of the barcode and text

Returns
TypeDescription
\unknown
methodpublicgetHeight( $recalculate = false) : integer

Get height of the result object

Parameters
NameTypeDescription
$recalculate
Returns
TypeDescription
integer
methodpublicgetInstructions() : array

Retrieve the set of drawing instructions

Returns
TypeDescription
array
methodpublicgetOffsetLeft(boolean $recalculate = false) : float

Calculate the offset from the left of the object if an orientation is activated

Parameters
NameTypeDescription
$recalculateboolean
Returns
TypeDescription
float
methodpublicgetOffsetTop(boolean $recalculate = false) : float

Calculate the offset from the top of the object if an orientation is activated

Parameters
NameTypeDescription
$recalculateboolean
Returns
TypeDescription
float
methodpublicgetOrientation() : float

Retrieve orientation of barcode and text

Returns
TypeDescription
float
methodpublicgetQuietZone() : integer

Quiet zone before first bar and after the last bar

Returns
TypeDescription
integer
methodpublicgetRawText() : string

Retrieve text to encode

Returns
TypeDescription
string
methodpublicgetStretchText() : boolean

Retrieve if the adjustment of the position of the characters to the position of the bars is enabled

Returns
TypeDescription
boolean
methodpublicgetText() : string

Retrieve text to encode

Returns
TypeDescription
string
methodpublicgetTextToDisplay() : string

Retrieve text to display

Returns
TypeDescription
string
methodpublicgetType() : string

Retrieve type of barcode

Returns
TypeDescription
string
methodpublicgetWidth( $recalculate = false) : integer

Get width of the result object

Parameters
NameTypeDescription
$recalculate
Returns
TypeDescription
integer
methodpublicgetWithBorder() : boolean

Retrieve if border are draw or not

Returns
TypeDescription
boolean
methodpublicgetWithChecksum() : boolean

Retrieve if the checksum character is automatically added to the barcode text

Returns
TypeDescription
boolean
methodpublicgetWithChecksumInText() : boolean

Retrieve if the checksum character is automatically added to the barcode text

Returns
TypeDescription
boolean
methodpublicgetWithQuietZones() : boolean

Retrieve if quiet zones are draw or not

Returns
TypeDescription
boolean
methodpublicsetBackgroundColor(integer $value) : \Zend_Barcode_Object

Set the color of the background

Parameters
NameTypeDescription
$valueinteger
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetBarHeight(integer $value) : \Zend_Barcode_Object

Set height of the barcode bar

Parameters
NameTypeDescription
$valueinteger
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetBarThickWidth(integer $value) : \Zend_Barcode_Object

Set thickness of thick bar

Parameters
NameTypeDescription
$valueinteger
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetBarThinWidth(integer $value) : \Zend_Barcode_Object

Set thickness of thin bar

Parameters
NameTypeDescription
$valueinteger
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetBarcodeFont(string $font) : void
static

Set the font for all instances of barcode

Parameters
NameTypeDescription
$fontstring
methodpublicsetBarcodeNamespace(string $namespace) : \Zend_Barcode_Object

Set barcode namespace for autoloading

Parameters
NameTypeDescription
$namespacestring
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetConfig(\Zend_Config $config) : \Zend_Barcode_Object

Set barcode state from config object

Parameters
NameTypeDescription
$config\Zend_Config
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetDrawText(boolean $value) : \Zend_Barcode_Object

Activate/deactivate drawing of text to encode

Parameters
NameTypeDescription
$valueboolean
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetFactor(float $value) : \Zend_Barcode_Object

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

Parameters
NameTypeDescription
$valuefloat
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetFont(integer | string $value) : \Zend_Barcode_Object

Set the font: - if integer between 1 and 5, use gd built-in fonts - if string, $value is assumed to be the path to a TTF font

Parameters
NameTypeDescription
$valueinteger | string
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetFontSize(float $value) : \Zend_Barcode_Object

Set the size of the font in case of TTF

Parameters
NameTypeDescription
$valuefloat
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetForeColor(string $value) : \Zend_Barcode_Object

Set color of the barcode and text

Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetOptions(array $options) : \Zend_Barcode_Object

Set barcode state from options array

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetOrientation(float $value) : \Zend_Barcode_Object

Set orientation of barcode and text

Parameters
NameTypeDescription
$valuefloat
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetReverseColor() : \Zend_Barcode_Object

Allow fast inversion of font/bars color and background color

Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetStretchText(boolean $value) : \Zend_Barcode_Object

Activate/deactivate the adjustment of the position of the characters to the position of the bars

Parameters
NameTypeDescription
$valueboolean
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetText(string $value) : \Zend_Barcode_Object

Set text to encode

Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetWithBorder(boolean $value) : \Zend_Barcode_Object

Activate/deactivate drawing of the bar

Parameters
NameTypeDescription
$valueboolean
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetWithChecksum(boolean $value) : \Zend_Barcode_Object

Activate/deactivate the automatic generation of the checksum character added to the barcode text

Parameters
NameTypeDescription
$valueboolean
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicsetWithChecksumInText(boolean $value) : \Zend_Barcode_Object

Activate/deactivate the automatic generation of the checksum character added to the barcode text

Parameters
NameTypeDescription
$valueboolean
Returns
TypeDescription
\Zend_Barcode_Object
Details
Throw
 
methodpublicsetWithQuietZones(boolean $value) : \Zend_Barcode_Object

Activate/deactivate drawing of the quiet zones

Parameters
NameTypeDescription
$valueboolean
Returns
TypeDescription
\Zend_Barcode_Object
methodpublicvalidateText(string $value) : void

Check for invalid characters

Parameters
NameTypeDescription
$valuestring

Text to be ckecked

Documentation was generated by phpDocumentor 2.2.0 .