当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter\FilterChain类代码示例

本文整理汇总了PHP中Zend\Filter\FilterChain的典型用法代码示例。如果您正苦于以下问题:PHP FilterChain类的具体用法?PHP FilterChain怎么用?PHP FilterChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FilterChain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: injectValidatorPluginManager

 public static function injectValidatorPluginManager(Form $form, ServiceLocatorInterface $sl)
 {
     $plugins = $sl->get('ValidatorManager');
     $chain = new FilterChain();
     $chain->setPluginManager($plugins);
     $form->getFormFactory()->getInputFilterFactory()->setDefaultFilterChain($chain);
 }
开发者ID:soflomo,项目名称:common,代码行数:7,代码来源:FormUtils.php

示例2: testDoctrineService

 public function testDoctrineService()
 {
     $serviceManager = $this->getApplication()->getServiceManager();
     $em = $serviceManager->get('doctrine.entitymanager.orm_default');
     $tool = new SchemaTool($em);
     $res = $tool->createSchema($em->getMetadataFactory()->getAllMetadata());
     // Create DB
     $resourceDefinition = array("objectManager" => "doctrine.entitymanager.orm_default", "serviceName" => "Artist", "entityClass" => "Db\\Entity\\Artist", "routeIdentifierName" => "artist_id", "entityIdentifierName" => "id", "routeMatch" => "/db-test/artist");
     $this->resource = $serviceManager->get('ZF\\Apigility\\Doctrine\\Admin\\Model\\DoctrineRestServiceResource');
     $this->resource->setModuleName('DbApi');
     $entity = $this->resource->create($resourceDefinition);
     $this->assertInstanceOf('ZF\\Apigility\\Doctrine\\Admin\\Model\\DoctrineRestServiceEntity', $entity);
     $controllerServiceName = $entity->controllerServiceName;
     $this->assertNotEmpty($controllerServiceName);
     $this->assertContains('DbApi\\V1\\Rest\\Artist\\Controller', $controllerServiceName);
     $filter = new FilterChain();
     $filter->attachByName('WordCamelCaseToUnderscore')->attachByName('StringToLower');
     $em = $serviceManager->get('doctrine.entitymanager.orm_default');
     $metadataFactory = $em->getMetadataFactory();
     $entityMetadata = $metadataFactory->getMetadataFor("Db\\Entity\\Artist");
     foreach ($entityMetadata->associationMappings as $mapping) {
         switch ($mapping['type']) {
             case 4:
                 $rpcServiceResource = $serviceManager->get('ZF\\Apigility\\Doctrine\\Admin\\Model\\DoctrineRpcServiceResource');
                 $rpcServiceResource->setModuleName('DbApi');
                 $rpcServiceResource->create(array('service_name' => 'Artist' . $mapping['fieldName'], 'route' => '/db-test/artist[/:parent_id]/' . $filter($mapping['fieldName']) . '[/:child_id]', 'http_methods' => array('GET', 'PUT', 'POST'), 'options' => array('target_entity' => $mapping['targetEntity'], 'source_entity' => $mapping['sourceEntity'], 'field_name' => $mapping['fieldName']), 'selector' => 'custom selector'));
                 break;
             default:
                 break;
         }
     }
 }
开发者ID:API-Skeletons,项目名称:zf-apigility-doctrine,代码行数:32,代码来源:DoctrineMetadata1Test.php

示例3: filter

 public static function filter($input)
 {
     $filterChain = new ZFilter\FilterChain();
     $filterChain->attach(new ZFilter\StringToLower(array('encoding' => 'UTF-8')))->attach(new \Zend\I18n\Filter\Alnum(true))->attach(new \ZendVN\Filter\RemoveCircuflex())->attach(new \Zend\Filter\PregReplace(array('pattern' => '#\\s+#', 'replacement' => '-')))->attach(new \Zend\Filter\Word\CamelCaseToDash());
     $output = $filterChain->filter($input);
     return $output;
 }
开发者ID:quangdungninh,项目名称:zendvnteam,代码行数:7,代码来源:FriendlyLink.php

示例4: __call

 public function __call($method, $args)
 {
     $filterChain = new FilterChain();
     $filterChain->attach(new CamelCaseToDash())->attach(new StringToLower());
     $icon = $filterChain->filter($method);
     return $this->render($icon, isset($args[0]) ? $args[0] : '', isset($args[1]) ? $args[1] : false);
 }
开发者ID:acplo,项目名称:acploui,代码行数:7,代码来源:Icon.php

示例5: testFilterPrependOrder

 /**
  * Ensures that filters can be prepended and will be executed in the
  * expected order
  */
 public function testFilterPrependOrder()
 {
     $filter = new FilterChain();
     $filter->appendFilter(new StripUpperCase())->prependFilter(new LowerCase());
     $value = 'AbC';
     $valueExpected = 'abc';
     $this->assertEquals($valueExpected, $filter($value));
 }
开发者ID:stunti,项目名称:zf2,代码行数:12,代码来源:FilterChainTest.php

示例6: getFilter

 /**
  * @return \Zend\Filter\FilterChain
  */
 private function getFilter()
 {
     if ($this->filter === null) {
         $filter = new FilterChain();
         $filter->attach(new CamelCaseToDash());
         $filter->attach(new StringToLower());
         $this->filter = $filter;
     }
     return $this->filter;
 }
开发者ID:spryker,项目名称:Kernel,代码行数:13,代码来源:BundleControllerActionRouteNameResolver.php

示例7: getCamelCaseToUnderscoreFilter

 /**
  * @return FilterChain
  */
 protected function getCamelCaseToUnderscoreFilter()
 {
     if (static::$camelCaseToUnderscoreFilter instanceof FilterChain) {
         return static::$camelCaseToUnderscoreFilter;
     }
     $filter = new FilterChain();
     $filter->attachByName('WordCamelCaseToUnderscore');
     $filter->attachByName('StringToLower');
     return static::$camelCaseToUnderscoreFilter = $filter;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:UnderscoreNamingStrategy.php

示例8: indexAction

 /**
  * List all modules
  *
  * @return \Zend\View\Model\ViewModel
  */
 public function indexAction()
 {
     $collection = new ModuleCollection();
     $filter = new Filter\Word\CamelCaseToSeparator();
     $filter->setSeparator('-');
     $filterChain = new Filter\FilterChain();
     $filterChain->attach($filter)->attach(new Filter\StringToLower());
     foreach ($collection->getModules() as $module) {
         $module->setData('route', $filterChain->filter($module->getName()));
     }
     return array('modules' => $collection->getModules());
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:17,代码来源:IndexController.php

示例9: __call

 /**
  * Display Icon
  *
  * @param  string                    $method
  * @param  array                     $argv
  * @throws \InvalidArgumentException
  * @return string
  */
 public function __call($method, $argv)
 {
     $filterChain = new FilterChain();
     $filterChain->attach(new CamelCaseToDash())->attach(new StringToLower());
     $icon = $filterChain->filter($method);
     if (!in_array($icon, $this->icons)) {
         throw new InvalidArgumentException($icon . ' is not supported');
     }
     if ($argv) {
         $argv = (string) $argv[0];
     }
     return $this->render($icon, $argv);
 }
开发者ID:suitedJK,项目名称:ZfcTwitterBootstrap,代码行数:21,代码来源:Icon.php

示例10: filter

 /**
  * Filters a value with given filters.
  *
  * @param  mixed $value
  * @param  array $filters
  * @return mixed
  * @throws InvalidFilterException If callback is not callable.
  */
 public function filter($value, array $filters)
 {
     $filterChain = new FilterChain();
     foreach ($filters as $name => $options) {
         $class = 'Zend\\Filter\\' . ucfirst($name);
         if (class_exists($class)) {
             $filterChain->attach(new $class($options));
         } else {
             throw new InvalidFilterException("{$class} class does not exist.");
         }
     }
     return $filterChain->filter($value);
 }
开发者ID:lfbittencourt,项目名称:fewter,代码行数:21,代码来源:ZendFilterStrategy.php

示例11: normalizeTag

 /**
  * Normalize tag
  *
  * Ensures tag is alphanumeric characters only, and all lowercase.
  *
  * @param  string $tag
  * @return string
  */
 public function normalizeTag($tag)
 {
     if (!isset($this->_tagFilter)) {
         $this->_tagFilter = new Filter\FilterChain();
         $this->_tagFilter->attach(new Filter\Alnum())->attach(new Filter\StringToLower());
     }
     return $this->_tagFilter->filter($tag);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:16,代码来源:HtmlTag.php

示例12: _convertTableNameToClassName

 protected function _convertTableNameToClassName($tableName)
 {
     if ($this->_nameFilter == null) {
         $this->_nameFilter = new \Zend\Filter\FilterChain();
         $this->_nameFilter->addFilter(new \Zend\Filter\Word\UnderscoreToCamelCase());
     }
     return $this->_nameFilter->filter($tableName);
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:8,代码来源:DbTable.php

示例13: provide

 /**
  * {@inheritDoc}
  */
 public function provide()
 {
     $container = [];
     $terms = $this->taxonomyManager->findAllTerms(true);
     $notTrashed = new NotTrashedCollectionFilter();
     $typeFilter = new TaxonomyTypeCollectionFilter(['curriculum-topic', 'curriculum-topic-folder']);
     $chain = new FilterChain();
     $chain->attach($notTrashed);
     $chain->attach($typeFilter);
     $terms = $chain->filter($terms);
     /* @var $term TaxonomyTermInterface */
     foreach ($terms as $term) {
         $result = $this->toDocument($term);
         $container[] = $result;
     }
     return $container;
 }
开发者ID:Rahsil,项目名称:athene2,代码行数:20,代码来源:TaxonomyProvider.php

示例14: getRouteNameFilter

 /**
  * Retrieve the filter chain for generating the route name
  *
  * @return FilterChain
  */
 protected function getRouteNameFilter()
 {
     if ($this->routeNameFilter instanceof FilterChain) {
         return $this->routeNameFilter;
     }
     $this->routeNameFilter = new FilterChain();
     $this->routeNameFilter->attachByName('Word\\CamelCaseToDash')->attachByName('StringToLower');
     return $this->routeNameFilter;
 }
开发者ID:alapini,项目名称:apigility-3hr-tutorial,代码行数:14,代码来源:RestServiceModel.php

示例15: filterNamespaceToDirectory

 /**
  * @return FilterChain
  */
 private function filterNamespaceToDirectory()
 {
     if (null === $this->filterNamespaceToDirectory) {
         $this->filterNamespaceToDirectory = new FilterChain();
         $this->filterNamespaceToDirectory->attach(new SeparatorToSeparator('\\', '|'));
         $this->filterNamespaceToDirectory->attach(new SeparatorToSeparator('|', DIRECTORY_SEPARATOR));
     }
     return $this->filterNamespaceToDirectory;
 }
开发者ID:proophsoftware,项目名称:prooph-cli,代码行数:12,代码来源:Psr4Info.php


注:本文中的Zend\Filter\FilterChain类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。