/**
  * @param ServiceLocatorInterface $services
  * @return Factory
  */
 protected function getInputFilterFactory(ServiceLocatorInterface $services)
 {
     if ($this->factory instanceof Factory) {
         return $this->factory;
     }
     $this->factory = new Factory();
     $this->factory->getDefaultFilterChain()->setPluginManager($this->getFilterPluginManager($services));
     $this->factory->getDefaultValidatorChain()->setPluginManager($this->getValidatorPluginManager($services));
     if ($services->has('FilterManager') && $services->has('ValidatorManager')) {
         $this->factory->setInputFilterManager($this->getInputFilterPluginManager($services));
     }
     return $this->factory;
 }
 /**
  * Create and return an InputFilterInputFilter instance.
  *
  * @param ContainerInterface $container
  * @param string $requestedName
  * @param null|array $options
  * @return InputFilterInputFilter
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $factory = new InputFilterFactory();
     $factory->setInputFilterManager($container->get('InputFilterManager'));
     $factory->getDefaultFilterChain()->setPluginManager($container->get('FilterManager'));
     $factory->getDefaultValidatorChain()->setPluginManager($container->get('ValidatorManager'));
     return new InputFilterInputFilter($factory);
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $inputFilters
  * @return InputFilterInputFilter
  */
 public function createService(ServiceLocatorInterface $inputFilters)
 {
     $services = $inputFilters->getServiceLocator();
     $factory = new InputFilterFactory();
     $factory->setInputFilterManager($inputFilters);
     $factory->getDefaultFilterChain()->setPluginManager($services->get('FilterManager'));
     $factory->getDefaultValidatorChain()->setPluginManager($services->get('ValidatorManager'));
     return new InputFilterInputFilter($factory);
 }
 /**
  * @param ContainerInterface $container
  * @return Factory
  */
 protected function getInputFilterFactory(ContainerInterface $container)
 {
     if ($this->factory instanceof Factory) {
         return $this->factory;
     }
     $this->factory = new Factory();
     $this->factory->getDefaultFilterChain()->setPluginManager($this->getFilterPluginManager($container));
     $this->factory->getDefaultValidatorChain()->setPluginManager($this->getValidatorPluginManager($container));
     $this->factory->setInputFilterManager($container->get('InputFilterManager'));
     return $this->factory;
 }
Ejemplo n.º 5
0
 public function testSetInputFilterManagerWithoutServiceManager()
 {
     $inputFilterManager = new InputFilterPluginManager();
     $factory = new Factory();
     $factory->setInputFilterManager($inputFilterManager);
     $this->assertSame($inputFilterManager, $factory->getInputFilterManager());
 }