當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。