Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / InputFilter / InputFilterPluginManager.php
blob757e3dc258d585cd1708378a01189e9805fc8fd6
1 <?php
2 /**
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
8 */
10 namespace Zend\InputFilter;
12 use Zend\InputFilter\Exception;
13 use Zend\ServiceManager\AbstractPluginManager;
14 use Zend\ServiceManager\ConfigInterface;
15 use Zend\ServiceManager\ServiceLocatorInterface;
16 use Zend\Stdlib\InitializableInterface;
18 /**
19 * Plugin manager implementation for input filters.
21 class InputFilterPluginManager extends AbstractPluginManager
23 /**
24 * Default set of plugins
26 * @var array
28 protected $invokableClasses = array(
29 'inputfilter' => 'Zend\InputFilter\InputFilter',
30 'collection' => 'Zend\InputFilter\CollectionInputFilter',
33 /**
34 * Whether or not to share by default
36 * @var bool
38 protected $shareByDefault = false;
40 /**
41 * @param ConfigInterface $configuration
43 public function __construct(ConfigInterface $configuration = null)
45 parent::__construct($configuration);
47 $this->addInitializer(array($this, 'populateFactory'));
50 /**
51 * Inject this and populate the factory with filter chain and validator chain
53 * @param $inputfilter
55 public function populateFactory($inputfilter)
57 if ($inputfilter instanceof InputFilter) {
58 $factory = $inputfilter->getFactory();
60 $factory->setInputFilterManager($this);
62 if ($this->serviceLocator instanceof ServiceLocatorInterface) {
63 $factory->getDefaultFilterChain()->setPluginManager($this->serviceLocator->get('FilterManager'));
64 $factory->getDefaultValidatorChain()->setPluginManager($this->serviceLocator->get('ValidatorManager'));
69 /**
70 * {@inheritDoc}
72 public function validatePlugin($plugin)
74 if ($plugin instanceof InputFilterInterface) {
75 // Hook to perform various initialization, when the inputfilter is not created through the factory
76 if ($plugin instanceof InitializableInterface) {
77 $plugin->init();
80 // we're okay
81 return;
84 throw new Exception\RuntimeException(sprintf(
85 'Plugin of type %s is invalid; must implement Zend\InputFilter\InputFilterInterface',
86 (is_object($plugin) ? get_class($plugin) : gettype($plugin))
87 ));