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


PHP OptionsResolver::clear方法代码示例

本文整理汇总了PHP中Symfony\Component\OptionsResolver\OptionsResolver::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP OptionsResolver::clear方法的具体用法?PHP OptionsResolver::clear怎么用?PHP OptionsResolver::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\OptionsResolver\OptionsResolver的用法示例。


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

示例1: clear

 /**
  * {@inheritDoc}
  */
 public function clear()
 {
     parent::clear();
     /* This must be done after the parent to ensure that the parent's locked state is enforced. */
     $this->casts = [];
     return $this;
 }
开发者ID:ebidtech,项目名称:options-resolver,代码行数:10,代码来源:OptionsResolver.php

示例2: testClearOptionAndNormalizer

 public function testClearOptionAndNormalizer()
 {
     $this->resolver->setDefault('foo1', 'bar');
     $this->resolver->setNormalizer('foo1', function (Options $options) {
         return '';
     });
     $this->resolver->setDefault('foo2', 'bar');
     $this->resolver->setNormalizer('foo2', function (Options $options) {
         return '';
     });
     $this->resolver->clear();
     $this->assertEmpty($this->resolver->resolve());
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:13,代码来源:OptionsResolver2Dot6Test.php

示例3: build

 /**
  * Build the filter with the given configuration.
  *
  * @param array $filterConfigurations
  * @return FilterInterface[]
  * @throws Exception
  */
 public function build(array $filterConfigurations)
 {
     $resolver = new OptionsResolver();
     $filters = [];
     foreach ($filterConfigurations as $filterName => $filterConfiguration) {
         $resolver->clear();
         if ($filterConfiguration === null) {
             $filterConfiguration = [];
         }
         $configuration = $this->getFilterConfiguration($filterName);
         $configuration->configureOptions($resolver);
         $configuration->setParameters($resolver->resolve($filterConfiguration));
         $class = $this->mapping[$filterName];
         /** @var FilterInterface $filter */
         $filter = new $class($filterName, $configuration, $this->eventDispatcher);
         $filter->checkRequirements();
         $filters[$filterName] = $filter;
     }
     return $filters;
 }
开发者ID:johnkrovitch,项目名称:sam,代码行数:27,代码来源:FilterBuilder.php

示例4: build

 /**
  * Build and return an array of Task.
  *
  * @param array $taskConfigurations
  * @return Task[]
  */
 public function build(array $taskConfigurations)
 {
     $resolver = new OptionsResolver();
     $tasks = [];
     foreach ($taskConfigurations as $taskName => $taskConfiguration) {
         $resolver->clear();
         // debug mode
         if ($this->debug === true) {
             $taskConfiguration['debug'] = $this->debug;
         }
         // add copy filter in last position if required
         if (!$this->hasCopyFilter($taskConfiguration)) {
             $taskConfiguration['filters'][] = 'copy';
         }
         $configuration = new TaskConfiguration();
         $configuration->configureOptions($resolver);
         $configuration->setParameters($resolver->resolve($taskConfiguration));
         $task = new Task($taskName, $configuration);
         $tasks[$taskName] = $task;
     }
     return $tasks;
 }
开发者ID:johnkrovitch,项目名称:sam,代码行数:28,代码来源:TaskBuilder.php

示例5: validate

 /**
  * @param array $data
  * @throws UndefinedOptionsException If an option name is undefined
  * @throws InvalidOptionsException   If an option doesn't fulfill the
  *                                   specified validation rules
  * @throws MissingOptionsException   If a required option is missing
  * @throws OptionDefinitionException If there is a cyclic dependency between
  *                                   lazy options and/or normalizers
  * @throws NoSuchOptionException     If a lazy option reads an unavailable option
  * @throws AccessException           If called from a lazy option or normalizer
  * @return bool
  */
 public function validate(array $data)
 {
     $this->optionResolver->resolve($data);
     $this->optionResolver->clear();
     return true;
 }
开发者ID:ndrx-io,项目名称:profiler,代码行数:18,代码来源:Validator.php

示例6: setOption

 /**
  * @param string $name
  * @param mixed  $value
  */
 public function setOption($name, $value)
 {
     $this->resolver->clear();
     $this->resolver->setDefaults($this->options);
     $this->options = $this->resolver->resolve(array($name => $value));
 }
开发者ID:yohang,项目名称:calendr,代码行数:10,代码来源:Factory.php


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