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


PHP OptionsResolver\OptionsResolver类代码示例

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


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

示例1: createOptionsResolver

 /**
  * @return OptionsResolverInterface
  */
 protected function createOptionsResolver()
 {
     $resolver = new OptionsResolver();
     $resolver->setOptional(['flush', 'copy_values_to_products', 'add_products', 'remove_products']);
     $resolver->setAllowedTypes(['flush' => 'bool', 'copy_values_to_products' => 'bool', 'add_products' => 'array', 'remove_products' => 'array']);
     return $resolver;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:10,代码来源:GroupSavingOptionsResolver.php

示例2: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     /* Note: the form's intention must correspond to that for the form login
      * listener in order for the CSRF token to validate successfully.
      */
     $resolver->setDefaults(array('intention' => 'authenticate'));
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:10,代码来源:UserLoginFormType.php

示例3: configureOptionResolver

 /**
  * {@inheritdoc}
  */
 protected static function configureOptionResolver(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['host' => '127.0.0.1', 'port' => 11211, 'redundant_servers' => []]);
     $resolver->setAllowedTypes('host', ['string']);
     $resolver->setAllowedTypes('port', ['string', 'int']);
     $resolver->setAllowedTypes('redundant_servers', ['array']);
 }
开发者ID:php-cache,项目名称:adapter-bundle,代码行数:10,代码来源:MemcacheFactory.php

示例4:

 function it_should_define_assigned_data_class(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['data_class' => 'Rule', 'validation_groups' => ['Default']])->shouldBeCalled();
     $resolver->setDefined(['configuration_type'])->shouldBeCalled();
     $resolver->setDefaults(['configuration_type' => RuleInterface::TYPE_ITEM_TOTAL])->shouldBeCalled();
     $this->configureOptions($resolver);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:7,代码来源:RuleTypeSpec.php

示例5: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired(['new_relic_app_name']);
     $resolver->setDefaults(['new_relic_license' => null, 'new_relic_transaction_name' => function (Options $options) {
         return sprintf('swarrot %s', $options['queue']);
     }]);
 }
开发者ID:behinddesign,项目名称:swarrot,代码行数:10,代码来源:NewRelicProcessor.php

示例6: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('type' => 'text', 'options' => array(), 'first_options' => array(), 'second_options' => array(), 'first_name' => 'first', 'second_name' => 'second', 'error_bubbling' => false));
     $resolver->setAllowedTypes('options', 'array');
     $resolver->setAllowedTypes('first_options', 'array');
     $resolver->setAllowedTypes('second_options', 'array');
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:10,代码来源:RepeatedType.php

示例7: configureOptions

 /**
  * @param OptionsResolver $resolver
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $user = $this->tokenStorage->getToken()->getUser();
     $resolver->setDefaults(array('data_class' => Task::class, 'empty_data' => function (FormInterface $form) use($user) {
         return new Task($form->getData()['name'], $user);
     }));
 }
开发者ID:klinki,项目名称:timer,代码行数:10,代码来源:TaskType.php

示例8: __construct

 /**
  * When creating this subscriber, you can configure a number of options.
  *
  * - refresh_client_matcher: RequestMatcher to identify valid refresh clients.
  * - refresh_client_ips:     IP or array of IPs that are allowed to refresh.
  *
  * Only set one of refresh_client_ips and refresh_client_matcher.
  *
  * @param array $options Options to overwrite the default options
  *
  * @throws \InvalidArgumentException if unknown keys are found in $options
  */
 public function __construct(array $options = [])
 {
     $resolver = new OptionsResolver();
     $resolver->setDefaults(['refresh_client_matcher' => null, 'refresh_client_ips' => null]);
     $options = $resolver->resolve($options);
     parent::__construct($options['refresh_client_matcher'], $options['refresh_client_ips']);
 }
开发者ID:heartshare,项目名称:FOSHttpCache,代码行数:19,代码来源:RefreshSubscriber.php

示例9: setCurrencyResolver

 /**
  * Resolve amount option
  *
  * @param OptionsResolver $resolver
  */
 protected function setCurrencyResolver(OptionsResolver $resolver)
 {
     $resolver->setAllowedTypes('currency', ['string', 'int']);
     $resolver->setAllowedValues('currency', function ($value) {
         return CurrencyTypes::currencyCodeExists($value) || CurrencyTypes::currencyNumberExists($value);
     });
 }
开发者ID:lsv,项目名称:altapay-php-api,代码行数:12,代码来源:CurrencyTrait.php

示例10: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['value_glue' => null, 'value_format' => null, 'empty_value' => null]);
     $resolver->setAllowedTypes('value_glue', ['string', 'null']);
     $resolver->setAllowedTypes('value_format', ['string', 'callable', 'null']);
     $resolver->setAllowedTypes('empty_value', ['string', 'array', 'null']);
 }
开发者ID:rollerworks,项目名称:datagrid,代码行数:10,代码来源:TextType.php

示例11: __construct

 /**
  * @param array $options
  */
 public function __construct(array $options)
 {
     $resolver = new OptionsResolver();
     $resolver->setRequired(['secret', 'currency', 'min_sum'])->setDefaults(['math' => new NativeMath(), 'currency' => 'usd', 'min_sum' => 0])->setAllowedTypes('math', MathInterface::class);
     $options = $resolver->resolve($options);
     $this->options = $options;
 }
开发者ID:moriony,项目名称:payment-gateway,代码行数:10,代码来源:StripeHandler.php

示例12: configureOptions

 /**
  * 
  * @param array $options
  * @return array
  */
 public function configureOptions(array $options = array())
 {
     $resolver = new OptionsResolver();
     $resolver->setDefaults(array('adapter' => 'default', 'host' => $this->getHost(), 'username' => null, 'password' => null, 'port' => $this->getPort(), 'auth_mode' => $this->getAuthMode(), 'encryption' => $this->getEncryption()));
     $this->options = $resolver->resolve($options);
     return $this->options;
 }
开发者ID:snikolow,项目名称:silex-issue-tracker,代码行数:12,代码来源:AbstractMailer.php

示例13: resolveConfigurationOptions

 /**
  * Resolves options
  *
  * @param array $options
  * @return array
  */
 protected function resolveConfigurationOptions(array $configurationOptions)
 {
     $optionsResolver = new OptionsResolver();
     $optionsResolver->setDefaults($this->defaultOptions);
     $optionsResolver->setRequired(array_keys($this->defaultOptions));
     return $optionsResolver->resolve($configurationOptions);
 }
开发者ID:EHLOVader,项目名称:CodeQualityThreshold,代码行数:13,代码来源:Tool.php

示例14: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $entryOptionsNormalizer = function (Options $options, $value) {
         $value['block_name'] = 'entry';
         return $value;
     };
     $optionsNormalizer = function (Options $options, $value) use($entryOptionsNormalizer) {
         if (null !== $value) {
             @trigger_error('The form option "options" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_options" instead.', E_USER_DEPRECATED);
         }
         return $entryOptionsNormalizer($options, $value);
     };
     $typeNormalizer = function (Options $options, $value) {
         if (null !== $value) {
             @trigger_error('The form option "type" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_type" instead.', E_USER_DEPRECATED);
         }
         return $value;
     };
     $entryType = function (Options $options) {
         if (null !== $options['type']) {
             return $options['type'];
         }
         return __NAMESPACE__ . '\\TextType';
     };
     $entryOptions = function (Options $options) {
         if (1 === count($options['options']) && isset($options['block_name'])) {
             return array();
         }
         return $options['options'];
     };
     $resolver->setDefaults(array('allow_add' => false, 'allow_delete' => false, 'prototype' => true, 'prototype_data' => null, 'prototype_name' => '__name__', 'type' => null, 'options' => null, 'entry_type' => $entryType, 'entry_options' => $entryOptions, 'delete_empty' => false));
     $resolver->setNormalizer('type', $typeNormalizer);
     $resolver->setNormalizer('options', $optionsNormalizer);
     $resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
 }
开发者ID:Kyra2778,项目名称:AMR,代码行数:38,代码来源:CollectionType.php

示例15: configureOptions

 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired(['roles']);
     $resolver->setDefaults(['csrf_protection' => false, 'data_class' => InviteUserCommand::class, 'empty_data' => function (FormInterface $form) {
         return new InviteUserCommand($form->get('email')->getData(), $this->roles);
     }]);
 }
开发者ID:kreta,项目名称:kreta,代码行数:7,代码来源:InviteType.php


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