Google News
logo
Zend framework - Interview Questions
What about Barcode Objects Zend framework?
Barcode objects allow you to generate barcodes independently of the rendering support. After generation, you can retrieve the barcode as an array of drawing instructions that you can provide to a renderer.
 
Objects have a large number of options. Most of them are common to all objects. These options can be set in three ways:
 
* As an array or a Traversable object passed to the constructor.
* As an array passed to the setOptions() method.
* Via individual setters for each configuration type.

Different ways to parameterize a barcode object
use Zend\Barcode\Object;

$options = array('text' => 'ZEND-FRAMEWORK', 'barHeight' => 40);

// Case 1: constructor
$barcode = new Object\Code39($options);

// Case 2: setOptions()
$barcode = new Object\Code39();
$barcode->setOptions($options);

// Case 3: individual setters
$barcode = new Object\Code39();
$barcode->setText('ZEND-FRAMEWORK')
        ->setBarHeight(40);
Advertisement