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


PHP OptionsResolver::setDefined方法代码示例

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


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

示例1: configureProperties

 protected function configureProperties(OptionsResolver $resolver)
 {
     $resolver->setDefined('logfile')->setAllowedTypes('logfile', 'string');
     $resolver->setDefined('logfile_maxbytes');
     $this->configureByteProperty('logfile_maxbytes', $resolver);
     $resolver->setDefined('logfile_backups');
     $this->configureIntegerProperty('logfile_backups', $resolver);
     $resolver->setDefined('loglevel')->setAllowedTypes('loglevel', 'string')->setAllowedValues('loglevel', ['critical', 'error', 'warn', 'info', 'debug', 'trace', 'blather']);
     $resolver->setDefined('pidfile')->setAllowedTypes('pidfile', 'string');
     // TODO: octal vs. decimal value
     $resolver->setDefined('umask');
     $this->configureIntegerProperty('umask', $resolver);
     $resolver->setDefined('nodaemon');
     $this->configureBooleanProperty('nodaemon', $resolver);
     $resolver->setDefined('minfds');
     $this->configureIntegerProperty('minfds', $resolver);
     $resolver->setDefined('minprocs');
     $this->configureIntegerProperty('minprocs', $resolver);
     $resolver->setDefined('nocleanup');
     $this->configureBooleanProperty('nocleanup', $resolver);
     $resolver->setDefined('childlogdir')->setAllowedTypes('childlogdir', 'string');
     $resolver->setDefined('user')->setAllowedTypes('user', 'string');
     $resolver->setDefined('directory')->setAllowedTypes('directory', 'string');
     $resolver->setDefined('strip_ansi');
     $this->configureBooleanProperty('strip_ansi', $resolver);
     $this->configureEnvironmentProperty($resolver);
     $resolver->setDefined('identifier')->setAllowedTypes('identifier', 'string');
 }
开发者ID:indigophp,项目名称:supervisor-configuration,代码行数:28,代码来源:Supervisord.php

示例2: configureProperties

 /**
  * {@inheritdoc}
  */
 protected function configureProperties(OptionsResolver $resolver)
 {
     $resolver->setDefined('supervisor.rpcinterface_factory')->setAllowedTypes('supervisor.rpcinterface_factory', 'string');
     // Note: undocumented, based on examples
     $resolver->setDefined('retries');
     $this->configureIntegerProperty('retries', $resolver);
 }
开发者ID:indigophp,项目名称:supervisor-configuration,代码行数:10,代码来源:RpcInterface.php

示例3: configureWeekMealOptions

 /**
  * Set up the configurations of options
  * passed as argument into the following methods of this class :
  * - getWeekDates
  * - getWeekMeals
  */
 private function configureWeekMealOptions()
 {
     $this->weekMealResolver->setDefined(array('date_day', 'without_pork', 'enable_next_week', 'days_ofweek_off', 'dates_off'));
     $this->weekMealResolver->setAllowedTypes('date_day', \DateTimeInterface::class);
     $this->weekMealResolver->setDefaults(array('without_pork' => false, 'enable_next_week' => false, 'days_ofweek_off' => array(Day::WEEK_WEDNESDAY), 'dates_off' => array()));
     $this->weekMealResolver->setRequired(array('without_pork', 'date_day'));
 }
开发者ID:WildCodeSchool,项目名称:projet-gesty,代码行数:13,代码来源:LunchRepository.php

示例4: __construct

 public function __construct(array $defaultParameters = array())
 {
     $this->parametersResolver = new SymfonyResolver();
     $this->parametersResolver->setDefaults(array_merge(array('currentPage' => 0, 'itemsPerPage' => 10), $defaultParameters))->setAllowedTypes('currentPage', 'int')->setAllowedTypes('itemsPerPage', 'int');
     $this->filtersResolver = new SymfonyResolver();
     $this->filtersResolver->setDefined(array('operator', 'value', 'sort'))->setDefaults(array('sort_priority' => 0, 'parsed' => false, 'sorted' => false))->setAllowedValues('sort', array(null, 'asc', 'desc'))->setAllowedValues('operator', array_merge(array(null), Operations::getTextOperators(), Operations::getChoiceOperators(), Operations::getDateTimeOperators()))->setAllowedTypes('sort_priority', 'int');
 }
开发者ID:WedgeSama,项目名称:Listor,代码行数:7,代码来源:OptionsResolver.php

示例5: configureOptions

 /**
  * Configure adapter options
  *
  * @param OptionsResolver $resolver
  * @throws \Symfony\Component\OptionsResolver\Exception\ExceptionInterface
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefined('digest_domains')->setAllowedTypes('digest_domains', 'string');
     $resolver->setDefined('nonce_timeout')->setAllowedTypes('nonce_timeout', 'int');
     $resolver->setDefault('use_opaque', false)->setAllowedTypes('use_opaque', 'bool');
     $resolver->setDefault('algorithm', 'MD5')->setAllowedTypes('algorithm', 'string');
 }
开发者ID:sunnyct,项目名称:silexcmf-zend-authentication,代码行数:13,代码来源:HttpDigest.php

示例6: __construct

 public function __construct(\Doctrine\ORM\EntityManager $em, \Doctrine\ORM\Mapping\ClassMetadata $class)
 {
     $this->resolverGetEleves = new OptionsResolver();
     $this->resolverGetEleves->setDefined(array('school_id', 'date_day', 'activity_type'));
     $this->resolverGetEleves->setAllowedTypes('date_day', \DateTimeInterface::class);
     $this->resolverGetEleves->setDefaults(array('school_id' => 0));
     parent::__construct($em, $class);
 }
开发者ID:WildCodeSchool,项目名称:projet-gesty,代码行数:8,代码来源:EleveRepository.php

示例7: configureProperties

 /**
  * {@inheritdoc}
  */
 protected function configureProperties(OptionsResolver $resolver)
 {
     $resolver->setDefined('serverurl')->setAllowedTypes('serverurl', 'string');
     $resolver->setDefined('username')->setAllowedTypes('username', 'string');
     $resolver->setDefined('password')->setAllowedTypes('password', 'string');
     $resolver->setDefined('prompt')->setAllowedTypes('prompt', 'string');
     $resolver->setDefined('history_file')->setAllowedTypes('history_file', 'string');
 }
开发者ID:indigophp,项目名称:supervisor-configuration,代码行数:11,代码来源:Supervisorctl.php

示例8: configureOptions

 /**
  * Configure adapter options
  *
  * @param  OptionsResolver $resolver
  * @throws \Symfony\Component\OptionsResolver\Exception\AccessException
  * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired('table_name')->setAllowedTypes('table_name', ['string']);
     $resolver->setRequired('identity_column')->setAllowedTypes('identity_column', ['string']);
     $resolver->setRequired('credential_column')->setAllowedTypes('credential_column', ['string']);
     $resolver->setDefined('roles_column')->setAllowedTypes('roles_column', ['string', 'null']);
     $resolver->setDefined('salt_column')->setAllowedTypes('salt_column', ['string', 'null']);
     $resolver->setDefault('use_ambiguity_identity', false)->setAllowedTypes('use_ambiguity_identity', ['bool']);
 }
开发者ID:sunnyct,项目名称:silexcmf,代码行数:16,代码来源:DatabaseProvider.php

示例9: configureProperties

 /**
  * {@inheritdoc}
  */
 protected function configureProperties(OptionsResolver $resolver)
 {
     $resolver->setDefined('file')->setAllowedTypes('file', 'string');
     // TODO: octal vs. decimal value
     $resolver->setDefined('chmod')->setAllowedTypes('chmod', 'int');
     $resolver->setDefined('chown')->setAllowedTypes('chown', 'string');
     $resolver->setDefined('username')->setAllowedTypes('username', 'string');
     $resolver->setDefined('password')->setAllowedTypes('password', ['string', 'numeric']);
 }
开发者ID:supervisorphp,项目名称:configuration,代码行数:12,代码来源:UnixHttpServer.php

示例10: configureProperties

 /**
  * {@inheritdoc}
  */
 protected function configureProperties(OptionsResolver $resolver)
 {
     $resolver->setDefined('file')->setAllowedTypes('file', 'string');
     // TODO: octal vs. decimal value
     $resolver->setDefined('chmod');
     $this->configureIntegerProperty('chmod', $resolver);
     $resolver->setDefined('chown')->setAllowedTypes('chown', 'string');
     $resolver->setDefined('username')->setAllowedTypes('username', 'string');
     $resolver->setDefined('password')->setAllowedTypes('password', 'string');
 }
开发者ID:indigophp,项目名称:supervisor-configuration,代码行数:13,代码来源:UnixHttpServer.php

示例11: configureProperties

 /**
  * {@inheritdoc}
  */
 protected function configureProperties(OptionsResolver $resolver)
 {
     $resolver->setRequired('port')->setAllowedTypes('port', ['integer', 'string'])->setNormalizer('port', function (Options $options, $value) {
         // We cast it to integer first to make sure it is an integer representation
         is_numeric($value) and $value = '*:' . intval($value);
         return $value;
     });
     $resolver->setDefined('username')->setAllowedTypes('username', 'string');
     $resolver->setDefined('password')->setAllowedTypes('password', ['string', 'numeric']);
 }
开发者ID:supervisorphp,项目名称:configuration,代码行数:13,代码来源:InetHttpServer.php

示例12: getConfigurableOptions

 /**
  * @return OptionsResolver
  */
 public function getConfigurableOptions()
 {
     $resolver = new OptionsResolver();
     $resolver->setDefined('clover_file');
     $resolver->setDefined('level');
     $resolver->addAllowedTypes('clover_file', ['string']);
     $resolver->addAllowedTypes('level', ['int', 'float']);
     $resolver->setDefaults(['level' => 100]);
     $resolver->setRequired('clover_file');
     return $resolver;
 }
开发者ID:phpro,项目名称:grumphp,代码行数:14,代码来源:CloverCoverage.php

示例13: resolveOptions

 /**
  * 合并和校验参数
  */
 public function resolveOptions()
 {
     $defaults = array('nonce_str' => Util::getRandomString(), 'client_ip' => Util::getClientIp());
     $resolver = new OptionsResolver();
     $resolver->setDefined($this->required)->setRequired($this->required)->setDefaults($defaults);
     return $resolver->resolve($this->toArray());
 }
开发者ID:thenbsp,项目名称:wechat,代码行数:10,代码来源:Cash.php

示例14:

 function it_defines_an_assigned_data_class(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['data_class' => 'PromotionRule', 'validation_groups' => ['Default']])->shouldBeCalled();
     $resolver->setDefined(['configuration_type'])->shouldBeCalled();
     $resolver->setDefaults(['configuration_type' => ItemTotalRuleChecker::TYPE])->shouldBeCalled();
     $this->configureOptions($resolver);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:PromotionRuleTypeSpec.php

示例15: configureOptions

 /**
  * Configure options
  *
  * @param OptionsResolver $resolver
  * @return void
  */
 protected function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setRequired(['amount']);
     $resolver->setDefined(['currency', 'terminal', 'credit_card_token', 'payment_id']);
     $resolver->setAllowedTypes('credit_card_token', 'string');
     $resolver->setAllowedTypes('payment_id', 'string');
     $resolver->setNormalizer('currency', function (Options $options, $value) {
         if (!isset($options['payment_id'])) {
             $fields = ['terminal', 'credit_card_token', 'currency'];
             foreach ($fields as $field) {
                 if (!isset($options[$field])) {
                     throw new \InvalidArgumentException(sprintf('The fields "%s" is required', implode(', ', $fields)));
                 }
             }
         }
         return $value;
     });
     $resolver->setNormalizer('payment_id', function (Options $options, $value) {
         $fields = ['currency', 'terminal', 'credit_card_token'];
         foreach ($fields as $field) {
             if (isset($options[$field])) {
                 throw new \InvalidArgumentException(sprintf('The fields "%s" is not allowed when "payment_id" is set', implode(', ', $fields)));
             }
         }
         return $value;
     });
 }
开发者ID:lsv,项目名称:altapay-php-api,代码行数:33,代码来源:CalculateSurcharge.php


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