diff --git a/src/Object/AbstractObject.php b/src/Object/AbstractObject.php index f8f430a..a74c1dc 100644 --- a/src/Object/AbstractObject.php +++ b/src/Object/AbstractObject.php @@ -21,48 +21,56 @@ abstract class AbstractObject implements ObjectInterface { /** * Namespace of the barcode for autoloading + * * @var string */ protected $barcodeNamespace = 'Zend\Barcode\Object'; /** * Set of drawing instructions + * * @var array */ protected $instructions = array(); /** * Barcode type + * * @var string */ protected $type = null; /** * Height of the object + * * @var int */ protected $height = null; /** * Width of the object + * * @var int */ protected $width = null; /** * Height of the bar + * * @var int */ protected $barHeight = 50; /** * Width of a thin bar + * * @var int */ protected $barThinWidth = 1; /** * Width of a thick bar + * * @var int */ protected $barThickWidth = 3; @@ -70,42 +78,49 @@ abstract class AbstractObject implements ObjectInterface /** * Factor to multiply bar and font measure * (barHeight, barThinWidth, barThickWidth & fontSize) + * * @var int */ protected $factor = 1; /** * Font and bars color of the object + * * @var int */ protected $foreColor = 0x000000; /** * Background color of the object + * * @var int */ protected $backgroundColor = 0xFFFFFF; /** * Activate/deactivate border of the object + * * @var bool */ protected $withBorder = false; /** * Activate/deactivate drawing of quiet zones + * * @var bool */ protected $withQuietZones = true; /** * Force quiet zones even if + * * @var bool */ protected $mandatoryQuietZones = false; /** * Orientation of the barcode in degrees + * * @var float */ protected $orientation = 0; @@ -113,6 +128,7 @@ abstract class AbstractObject implements ObjectInterface /** * Offset from the top the object * (calculated from the orientation) + * * @var int */ protected $offsetTop = null; @@ -120,24 +136,28 @@ abstract class AbstractObject implements ObjectInterface /** * Offset from the left the object * (calculated from the orientation) + * * @var int */ protected $offsetLeft = null; /** * Text to display + * * @var string */ protected $text = null; /** * Display (or not) human readable text + * * @var bool */ protected $drawText = true; /** * Adjust (or not) position of human readable characters with barcode + * * @var bool */ protected $stretchText = false; @@ -146,30 +166,35 @@ abstract class AbstractObject implements ObjectInterface * Font resource * - integer (1 to 5): corresponds to GD included fonts * - string: corresponds to path of a TTF font + * * @var int|string */ protected $font = null; /** * Font size + * * @var float */ protected $fontSize = 10; /** * Drawing of checksum + * * @var bool */ protected $withChecksum = false; /** * Drawing of checksum inside text + * * @var bool */ protected $withChecksumInText = false; /** * Fix barcode length (numeric or string like 'even') + * * @var int | string */ protected $barcodeLength = null; @@ -177,6 +202,7 @@ abstract class AbstractObject implements ObjectInterface /** * Activate automatic addition of leading zeros * if barcode length is fixed + * * @var bool */ protected $addLeadingZeros = true; @@ -184,18 +210,21 @@ abstract class AbstractObject implements ObjectInterface /** * Activation of mandatory checksum * to deactivate unauthorized modification + * * @var bool */ protected $mandatoryChecksum = false; /** * Character used to substitute checksum character for validation + * * @var mixed */ protected $substituteChecksumCharacter = 0; /** * Constructor + * * @param array|Traversable $options */ public function __construct($options = null) @@ -217,7 +246,6 @@ public function __construct($options = null) /** * Set default options for particular object - * @return void */ protected function getDefaultOptions() { @@ -225,6 +253,7 @@ protected function getDefaultOptions() /** * Set barcode state from options array + * * @param array $options * @return \Zend\Barcode\Object\ObjectInterface */ @@ -263,6 +292,7 @@ public function getBarcodeNamespace() /** * Retrieve type of barcode + * * @return string */ public function getType() @@ -272,6 +302,7 @@ public function getType() /** * Set height of the barcode bar + * * @param int $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -289,6 +320,7 @@ public function setBarHeight($value) /** * Get height of the barcode bar + * * @return int */ public function getBarHeight() @@ -298,6 +330,7 @@ public function getBarHeight() /** * Set thickness of thin bar + * * @param int $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -315,6 +348,7 @@ public function setBarThinWidth($value) /** * Get thickness of thin bar + * * @return int */ public function getBarThinWidth() @@ -324,6 +358,7 @@ public function getBarThinWidth() /** * Set thickness of thick bar + * * @param int $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -341,6 +376,7 @@ public function setBarThickWidth($value) /** * Get thickness of thick bar + * * @return int */ public function getBarThickWidth() @@ -351,7 +387,8 @@ public function getBarThickWidth() /** * Set factor applying to * thinBarWidth - thickBarWidth - barHeight - fontSize - * @param float $value + * + * @param int|float|string|bool $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface */ @@ -369,6 +406,7 @@ public function setFactor($value) /** * Get factor applying to * thinBarWidth - thickBarWidth - barHeight - fontSize + * * @return int */ public function getFactor() @@ -378,6 +416,7 @@ public function getFactor() /** * Set color of the barcode and text + * * @param string $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -398,6 +437,7 @@ public function setForeColor($value) /** * Retrieve color of the barcode and text + * * @return int */ public function getForeColor() @@ -407,6 +447,7 @@ public function getForeColor() /** * Set the color of the background + * * @param int $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -427,6 +468,7 @@ public function setBackgroundColor($value) /** * Retrieve background color of the image + * * @return int */ public function getBackgroundColor() @@ -436,6 +478,7 @@ public function getBackgroundColor() /** * Activate/deactivate drawing of the bar + * * @param bool $value * @return \Zend\Barcode\Object\ObjectInterface */ @@ -447,6 +490,7 @@ public function setWithBorder($value) /** * Retrieve if border are draw or not + * * @return bool */ public function getWithBorder() @@ -456,6 +500,7 @@ public function getWithBorder() /** * Activate/deactivate drawing of the quiet zones + * * @param bool $value * @return AbstractObject */ @@ -467,6 +512,7 @@ public function setWithQuietZones($value) /** * Retrieve if quiet zones are draw or not + * * @return bool */ public function getWithQuietZones() @@ -476,6 +522,7 @@ public function getWithQuietZones() /** * Allow fast inversion of font/bars color and background color + * * @return \Zend\Barcode\Object\ObjectInterface */ public function setReverseColor() @@ -488,7 +535,8 @@ public function setReverseColor() /** * Set orientation of barcode and text - * @param float $value + * + * @param int|float|string|bool $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface */ @@ -500,6 +548,7 @@ public function setOrientation($value) /** * Retrieve orientation of barcode and text + * * @return float */ public function getOrientation() @@ -509,6 +558,7 @@ public function getOrientation() /** * Set text to encode + * * @param string $value * @return \Zend\Barcode\Object\ObjectInterface */ @@ -520,6 +570,7 @@ public function setText($value) /** * Retrieve text to encode + * * @return string */ public function getText() @@ -533,8 +584,9 @@ public function getText() /** * Automatically add leading zeros if barcode length is fixed - * @param string $text - * @param bool $withoutChecksum + * + * @param string $text + * @param bool $withoutChecksum * @return string */ protected function addLeadingZeros($text, $withoutChecksum = false) @@ -557,6 +609,7 @@ protected function addLeadingZeros($text, $withoutChecksum = false) /** * Retrieve text to encode + * * @return string */ public function getRawText() @@ -566,6 +619,7 @@ public function getRawText() /** * Retrieve text to display + * * @return string */ public function getTextToDisplay() @@ -579,6 +633,7 @@ public function getTextToDisplay() /** * Activate/deactivate drawing of text to encode + * * @param bool $value * @return \Zend\Barcode\Object\ObjectInterface */ @@ -590,6 +645,7 @@ public function setDrawText($value) /** * Retrieve if drawing of text to encode is enabled + * * @return bool */ public function getDrawText() @@ -600,6 +656,7 @@ public function getDrawText() /** * Activate/deactivate the adjustment of the position * of the characters to the position of the bars + * * @param bool $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -613,6 +670,7 @@ public function setStretchText($value) /** * Retrieve if the adjustment of the position of the characters * to the position of the bars is enabled + * * @return bool */ public function getStretchText() @@ -624,6 +682,7 @@ public function getStretchText() * Activate/deactivate the automatic generation * of the checksum character * added to the barcode text + * * @param bool $value * @return \Zend\Barcode\Object\ObjectInterface */ @@ -638,6 +697,7 @@ public function setWithChecksum($value) /** * Retrieve if the checksum character is automatically * added to the barcode text + * * @return bool */ public function getWithChecksum() @@ -649,6 +709,7 @@ public function getWithChecksum() * Activate/deactivate the automatic generation * of the checksum character * added to the barcode text + * * @param bool $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -664,6 +725,7 @@ public function setWithChecksumInText($value) /** * Retrieve if the checksum character is automatically * added to the barcode text + * * @return bool */ public function getWithChecksumInText() @@ -675,6 +737,7 @@ public function getWithChecksumInText() * 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 + * * @param int|string $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -706,6 +769,7 @@ public function setFont($value) /** * Retrieve the font + * * @return int|string */ public function getFont() @@ -715,6 +779,7 @@ public function getFont() /** * Set the size of the font in case of TTF + * * @param float $value * @return \Zend\Barcode\Object\ObjectInterface * @throws \Zend\Barcode\Object\Exception\ExceptionInterface @@ -748,6 +813,7 @@ public function getFontSize() /** * Quiet zone before first bar * and after the last bar + * * @return int */ public function getQuietZone() @@ -761,6 +827,7 @@ public function getQuietZone() /** * Add an instruction in the array of instructions + * * @param array $instruction */ protected function addInstruction(array $instruction) @@ -770,6 +837,7 @@ protected function addInstruction(array $instruction) /** * Retrieve the set of drawing instructions + * * @return array */ public function getInstructions() @@ -779,9 +847,10 @@ public function getInstructions() /** * Add a polygon drawing instruction in the set of instructions + * * @param array $points - * @param int $color - * @param bool $filled + * @param int $color + * @param bool $filled */ protected function addPolygon(array $points, $color = null, $filled = true) { @@ -798,13 +867,14 @@ protected function addPolygon(array $points, $color = null, $filled = true) /** * Add a text drawing instruction in the set of instructions + * * @param string $text - * @param float $size - * @param int[] $position + * @param float $size + * @param int[] $position * @param string $font - * @param int $color + * @param int $color * @param string $alignment - * @param float $orientation + * @param float $orientation */ protected function addText( $text, @@ -832,6 +902,7 @@ protected function addText( /** * Checking of parameters after all settings + * * @return bool */ public function checkParams() @@ -844,8 +915,8 @@ public function checkParams() /** * Check if a text is really provided to barcode + * * @param string|null $value - * @return void * @throws \Zend\Barcode\Object\Exception\ExceptionInterface */ protected function checkText($value = null) @@ -863,9 +934,9 @@ protected function checkText($value = null) /** * Check the ratio between the thick and the thin bar + * * @param int $min * @param int $max - * @return void * @throws \Zend\Barcode\Object\Exception\ExceptionInterface */ protected function checkRatio($min = 2, $max = 3) @@ -883,7 +954,7 @@ protected function checkRatio($min = 2, $max = 3) /** * Drawing with an angle is just allow TTF font - * @return void + * * @throws \Zend\Barcode\Object\Exception\ExceptionInterface */ protected function checkFontAndOrientation() @@ -898,6 +969,7 @@ protected function checkFontAndOrientation() /** * Width of the result image * (before any rotation) + * * @return int */ protected function calculateWidth() @@ -909,12 +981,14 @@ protected function calculateWidth() /** * Calculate the width of the barcode + * * @return int */ abstract protected function calculateBarcodeWidth(); /** * Height of the result object + * * @return int */ protected function calculateHeight() @@ -926,6 +1000,7 @@ protected function calculateHeight() /** * Height of the barcode + * * @return int */ protected function calculateBarcodeHeight() @@ -941,6 +1016,7 @@ protected function calculateBarcodeHeight() /** * Get height of the result object + * * @param bool $recalculate * @return int */ @@ -956,6 +1032,7 @@ public function getHeight($recalculate = false) /** * Get width of the result object + * * @param bool $recalculate * @return int */ @@ -972,6 +1049,7 @@ public function getWidth($recalculate = false) /** * Calculate the offset from the left of the object * if an orientation is activated + * * @param bool $recalculate * @return float */ @@ -993,6 +1071,7 @@ public function getOffsetLeft($recalculate = false) /** * Calculate the offset from the top of the object * if an orientation is activated + * * @param bool $recalculate * @return float */ @@ -1013,9 +1092,10 @@ public function getOffsetTop($recalculate = false) /** * Apply rotation on a point in X/Y dimensions - * @param float $x1 x-position before rotation - * @param float $y1 y-position before rotation - * @return int[] Array of two elements corresponding to the new XY point + * + * @param float $x1 x-position before rotation + * @param float $y1 y-position before rotation + * @return array Array of two elements corresponding to the new XY point */ protected function rotate($x1, $y1) { @@ -1030,6 +1110,7 @@ protected function rotate($x1, $y1) /** * Complete drawing of the barcode + * * @return array Table of instructions */ public function draw() @@ -1043,7 +1124,6 @@ public function draw() /** * Draw the barcode - * @return void */ protected function drawBarcode() { @@ -1100,7 +1180,6 @@ protected function drawBarcode() /** * Partial function to draw border - * @return void */ protected function drawBorder() { @@ -1124,7 +1203,6 @@ protected function drawBorder() /** * Partial function to draw text - * @return void */ protected function drawText() { @@ -1167,8 +1245,8 @@ protected function drawText() /** * Check for invalid characters - * @param string $value Text to be checked - * @return void + * + * @param string $value Text to be checked */ public function validateText($value) { @@ -1177,6 +1255,7 @@ public function validateText($value) /** * Standard validation for most of barcode objects + * * @param string $value * @param array $options */ @@ -1222,15 +1301,11 @@ abstract protected function prepareBarcode(); /** * Checking of parameters after all settings - * - * @return void */ abstract protected function checkSpecificParams(); /** * Allow each child to draw something else - * - * @return void */ protected function preDrawBarcode() { @@ -1239,8 +1314,6 @@ protected function preDrawBarcode() /** * Allow each child to draw something else * (ex: bearer bars in interleaved 2 of 5 code) - * - * @return void */ protected function postDrawBarcode() {