3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Barcode
;
12 use Zend\ServiceManager\AbstractPluginManager
;
15 * Plugin manager implementation for barcode parsers.
17 * Enforces that barcode parsers retrieved are instances of
18 * Object\AbstractObject. Additionally, it registers a number of default
21 class ObjectPluginManager
extends AbstractPluginManager
24 * @var bool Ensure services are not shared
26 protected $shareByDefault = false;
29 * Default set of barcode parsers
33 protected $invokableClasses = array(
34 'codabar' => 'Zend\Barcode\Object\Codabar',
35 'code128' => 'Zend\Barcode\Object\Code128',
36 'code25' => 'Zend\Barcode\Object\Code25',
37 'code25interleaved' => 'Zend\Barcode\Object\Code25interleaved',
38 'code39' => 'Zend\Barcode\Object\Code39',
39 'ean13' => 'Zend\Barcode\Object\Ean13',
40 'ean2' => 'Zend\Barcode\Object\Ean2',
41 'ean5' => 'Zend\Barcode\Object\Ean5',
42 'ean8' => 'Zend\Barcode\Object\Ean8',
43 'error' => 'Zend\Barcode\Object\Error',
44 'identcode' => 'Zend\Barcode\Object\Identcode',
45 'itf14' => 'Zend\Barcode\Object\Itf14',
46 'leitcode' => 'Zend\Barcode\Object\Leitcode',
47 'planet' => 'Zend\Barcode\Object\Planet',
48 'postnet' => 'Zend\Barcode\Object\Postnet',
49 'royalmail' => 'Zend\Barcode\Object\Royalmail',
50 'upca' => 'Zend\Barcode\Object\Upca',
51 'upce' => 'Zend\Barcode\Object\Upce',
57 * Checks that the barcode parser loaded is an instance
58 * of Object\AbstractObject.
60 * @param mixed $plugin
62 * @throws Exception\InvalidArgumentException if invalid
64 public function validatePlugin($plugin)
66 if ($plugin instanceof Object\AbstractObject
) {
71 throw new Exception\
InvalidArgumentException(sprintf(
72 'Plugin of type %s is invalid; must extend %s\Object\AbstractObject',
73 (is_object($plugin) ?
get_class($plugin) : gettype($plugin)),