Factory method that returns the appropriate barcode encoder instance based on the requested barcode type.
private static function get_barcode_instance($barcode_type='Code128')
{
switch($barcode_type)
{
case 'Code39':
return new emberlabs\Barcode\Code39();
break;
case 'Code128':
default:
return new emberlabs\Barcode\Code128();
break;
case 'Ean8':
return new emberlabs\Barcode\Ean8();
break;
case 'Ean13':
return new emberlabs\Barcode\Ean13();
break;
}
}
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key