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