本文整理匯總了PHP中Zend\InputFilter\Factory::getDefaultFilterChain方法的典型用法代碼示例。如果您正苦於以下問題:PHP Factory::getDefaultFilterChain方法的具體用法?PHP Factory::getDefaultFilterChain怎麽用?PHP Factory::getDefaultFilterChain使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\InputFilter\Factory
的用法示例。
在下文中一共展示了Factory::getDefaultFilterChain方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInputFilterFactory
/**
* @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));
return $this->factory;
}
示例2: __invoke
public function __invoke(ContainerInterface $container)
{
$factory = new Factory($container->get(InputFilterPluginManager::class));
$factory->getDefaultFilterChain()->setPluginManager($container->get(FilterPluginManager::class));
$factory->getDefaultValidatorChain()->setPluginManager($container->get(ValidatorPluginManager::class));
return $factory;
}
示例3: testFactoryAllowsInjectingFilterChain
public function testFactoryAllowsInjectingFilterChain()
{
$factory = new Factory();
$filterChain = new Filter\FilterChain();
$factory->setDefaultFilterChain($filterChain);
$this->assertSame($filterChain, $factory->getDefaultFilterChain());
}
示例4: __invoke
/**
* 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);
}
示例5: createService
/**
* 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);
}
示例6: populateFactoryPluginManagers
/**
* Populate the filter and validator managers for the default filter/validator chains.
*
* @param Factory $factory
* @return void
*/
public function populateFactoryPluginManagers(Factory $factory)
{
$container = property_exists($this, 'creationContext') ? $this->creationContext : $this->serviceLocator;
// v2
if ($container && $container->has('FilterManager')) {
$factory->getDefaultFilterChain()->setPluginManager($container->get('FilterManager'));
}
if ($container && $container->has('ValidatorManager')) {
$factory->getDefaultValidatorChain()->setPluginManager($container->get('ValidatorManager'));
}
}
示例7: getInputFilterFactory
/**
* @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;
}
示例8: __invoke
/**
* @param ContainerInterface $container
*
* @return Factory
*/
public function __invoke(ContainerInterface $container)
{
$config = $container->get('config');
$filters = isset($config['zend-inputfilter']['filters']) ? $config['zend-inputfilter']['filters'] : [];
$validators = isset($config['zend-inputfilter']['validators']) ? $config['zend-inputfilter']['validators'] : [];
// Construct factory
$factory = new Factory(new InputFilterPluginManager($container));
$factory->getDefaultFilterChain()->setPluginManager(new FilterPluginManager($container, $filters));
$factory->getDefaultValidatorChain()->setPluginManager(new ValidatorPluginManager($container, $validators));
return $factory;
}
示例9: testSetInputFilterManagerWithServiceManager
public function testSetInputFilterManagerWithServiceManager()
{
$inputFilterManager = new InputFilterPluginManager();
$serviceManager = new ServiceManager\ServiceManager();
$serviceManager->setService('ValidatorManager', new Validator\ValidatorPluginManager());
$serviceManager->setService('FilterManager', new Filter\FilterPluginManager());
$inputFilterManager->setServiceLocator($serviceManager);
$factory = new Factory();
$factory->setInputFilterManager($inputFilterManager);
$this->assertInstanceOf('Zend\\Validator\\ValidatorPluginManager', $factory->getDefaultValidatorChain()->getPluginManager());
$this->assertInstanceOf('Zend\\Filter\\FilterPluginManager', $factory->getDefaultFilterChain()->getPluginManager());
}
示例10: getFactories
//.........這裏部分代碼省略.........
return $sessionManager;
}, 'InoOicServer\\SessionIdGenerator' => function (ServiceManager $sm) {
$config = $sm->get('Config');
if (!isset($config['oic_server']['session_id_generator'])) {
throw new Exception\ConfigNotFoundException('session_id_generator');
}
$generatorConfig = $config['oic_server']['session_id_generator'];
if (!isset($generatorConfig['class'])) {
throw new Exception\ConfigNotFoundException('session_id_generator/class');
}
$className = $generatorConfig['class'];
$options = array();
if (isset($generatorConfig['options']) && is_array($generatorConfig['options'])) {
$options = $generatorConfig['options'];
}
return new $className($options);
}, 'InoOicServer\\AuthenticationManager' => function (ServiceManager $sm) {
$config = $sm->get('Config');
if (!isset($config['oic_server']['authentication'])) {
throw new Exception\ConfigNotFoundException('authentication');
}
$manager = new Authentication\Manager($config['oic_server']['authentication']);
return $manager;
}, 'InoOicServer\\ClientAuthenticationManager' => function (ServiceManager $sm) {
$config = $sm->get('Config');
if (!isset($config['oic_server']['client_authentication_manager']) || !is_array($config['oic_server']['client_authentication_manager'])) {
throw new Exception\ConfigNotFoundException('client_authentication_manager');
}
$manager = new Client\Authentication\Manager($config['oic_server']['client_authentication_manager']);
return $manager;
}, 'InoOicServer\\AuthorizeContextManager' => function (ServiceManager $sm) {
$config = $sm->get('Config');
$timeout = null;
if (isset($config['oic_server']['context_authorize']['timeout'])) {
$timeout = intval($config['oic_server']['context_authorize']['timeout']);
}
$contextStorage = $sm->get('InoOicServer\\ContextStorage');
$sessionContainer = $sm->get('InoOicServer\\SessionContainer');
$contextStorage->setSessionContainer($sessionContainer);
$contextFactory = $sm->get('InoOicServer\\AuthorizeContextFactory');
$requestFactory = $sm->get('InoOicServer\\AuthorizeRequestFactory');
$manager = new AuthorizeContextManager($contextStorage, $requestFactory, $contextFactory);
if ($timeout) {
$manager->setTimeout($timeout);
}
return $manager;
}, 'InoOicServer\\AuthorizeDispatcher' => function (ServiceManager $sm) {
$dispatcher = new Dispatcher\Authorize();
$dispatcher->setAuthorizeResponse($sm->get('InoOicServer\\AuthorizeResponse'));
$dispatcher->setClientRegistry($sm->get('InoOicServer\\ClientRegistry'));
$dispatcher->setSessionManager($sm->get('InoOicServer\\OicSessionManager'));
$dispatcher->setDataConnector($sm->get('InoOicServer\\UserDataConnector'));
$dispatcher->setUserValidator($sm->get('InoOicServer\\UserValidator'));
return $dispatcher;
}, 'InoOicServer\\AuthorizeRequest' => function (ServiceManager $sm) {
$httpRequest = $sm->get('Zend\\HttpRequest');
$request = new Simple($httpRequest);
return $request;
}, 'InoOicServer\\AuthorizeResponse' => function (ServiceManager $sm) {
return new Response\Authorize\Simple($sm->get('Response'));
}, 'InoOicServer\\TokenDispatcher' => function (ServiceManager $sm) {
$dispatcher = new Dispatcher\Token();
$dispatcher->setClientRegistry($sm->get('InoOicServer\\ClientRegistry'));
$dispatcher->setSessionManager($sm->get('InoOicServer\\OicSessionManager'));
$dispatcher->setTokenRequest($sm->get('InoOicServer\\TokenRequest'));
$dispatcher->setTokenResponse($sm->get('InoOicServer\\TokenResponse'));
$dispatcher->setClientAuthenticationManager($sm->get('InoOicServer\\ClientAuthenticationManager'));
return $dispatcher;
}, 'InoOicServer\\TokenRequest' => function (ServiceManager $sm) {
return new Request\Token($sm->get('Request'));
}, 'InoOicServer\\TokenResponse' => function (ServiceManager $sm) {
return new Response\Token($sm->get('Response'));
}, 'InoOicServer\\UserInfoDispatcher' => function (ServiceManager $sm) {
$dispatcher = new Dispatcher\UserInfo();
$dispatcher->setSessionManager($sm->get('InoOicServer\\OicSessionManager'));
$dispatcher->setUserInfoRequest($sm->get('InoOicServer\\UserInfoRequest'));
$dispatcher->setUserInfoResponse($sm->get('InoOicServer\\UserInfoResponse'));
$dispatcher->setUserInfoMapper($sm->get('InoOicServer\\UserInfoMapper'));
return $dispatcher;
}, 'InoOicServer\\UserInfoRequest' => function (ServiceManager $sm) {
return new Request\UserInfo($sm->get('Request'));
}, 'InoOicServer\\UserInfoResponse' => function (ServiceManager $sm) {
return new Response\UserInfo($sm->get('Response'));
}, 'InoOicServer\\InputFilterFactory' => function (ServiceManager $sm) {
$factory = new Factory();
$config = $sm->get('Config');
if (isset($config['oic_server']['filter_invokables'])) {
$filterInvokables = $config['oic_server']['filter_invokables'];
$factory->setDefaultFilterChain(new FilterChain());
$pluginManager = $factory->getDefaultFilterChain()->getPluginManager();
foreach ($filterInvokables as $filterName => $filterClass) {
$pluginManager->setInvokableClass($filterName, $filterClass);
}
}
return $factory;
}, 'Zend\\HttpRequest' => function (ServiceManager $sm) {
$request = new \Zend\Http\PhpEnvironment\Request();
return $request;
});
}