本文整理汇总了PHP中Zend\InputFilter\Factory::setDefaultFilterChain方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::setDefaultFilterChain方法的具体用法?PHP Factory::setDefaultFilterChain怎么用?PHP Factory::setDefaultFilterChain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\InputFilter\Factory
的用法示例。
在下文中一共展示了Factory::setDefaultFilterChain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFactoryInjectsComposedFilterAndValidatorChainsIntoInputObjectsWhenCreatingNewInputFilterObjects
public function testFactoryInjectsComposedFilterAndValidatorChainsIntoInputObjectsWhenCreatingNewInputFilterObjects()
{
$factory = new Factory();
$filterPlugins = new Filter\FilterPluginManager();
$validatorPlugins = new Validator\ValidatorPluginManager();
$filterChain = new Filter\FilterChain();
$validatorChain = new Validator\ValidatorChain();
$filterChain->setPluginManager($filterPlugins);
$validatorChain->setPluginManager($validatorPlugins);
$factory->setDefaultFilterChain($filterChain);
$factory->setDefaultValidatorChain($validatorChain);
$inputFilter = $factory->createInputFilter(array('foo' => array('name' => 'foo')));
$this->assertInstanceOf('Zend\\InputFilter\\InputFilterInterface', $inputFilter);
$this->assertEquals(1, count($inputFilter));
$input = $inputFilter->get('foo');
$this->assertInstanceOf('Zend\\InputFilter\\InputInterface', $input);
$inputFilterChain = $input->getFilterChain();
$inputValidatorChain = $input->getValidatorChain();
$this->assertSame($filterPlugins, $inputFilterChain->getPluginManager());
$this->assertSame($validatorPlugins, $inputValidatorChain->getPluginManager());
}
示例2: 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;
});
}