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


PHP AbstractValidator::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Sets validator options
  *
  * @param  string|array|\Traversable $options
  */
 public function __construct($options = null)
 {
     if ($options instanceof Traversable) {
         $options = ArrayUtils::iteratorToArray($options);
     }
     $case = null;
     if (1 < func_num_args()) {
         $case = func_get_arg(1);
     }
     if (is_array($options)) {
         if (isset($options['case'])) {
             $case = $options['case'];
             unset($options['case']);
         }
         if (!array_key_exists('extension', $options)) {
             $options = array('extension' => $options);
         }
     } else {
         $options = array('extension' => $options);
     }
     if ($case !== null) {
         $options['case'] = $case;
     }
     parent::__construct($options);
 }
开发者ID:paulbriton,项目名称:streaming_diffusion,代码行数:30,代码来源:Extension.php

示例2: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     if ($options && isset($options['dateFormat'])) {
         $this->setDateFormat($options['dateFormat']);
     }
 }
开发者ID:atasciuc,项目名称:zend-expressive-validation,代码行数:7,代码来源:ValidDateTime.php

示例3: __construct

 public function __construct($options = null)
 {
     if ($options instanceof JobRepository) {
         $options = array('repository' => $options);
     }
     parent::__construct($options);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:7,代码来源:UniqueApplyId.php

示例4: __construct

 /**
  * Sets validator options
  *
  * @param  array|Traversable $options
  *
  * @throws Exception\InvalidArgumentException
  */
 public function __construct($options = null)
 {
     if ($options instanceof Traversable) {
         $options = ArrayUtils::iteratorToArray($options);
     }
     parent::__construct($options);
 }
开发者ID:peteraba,项目名称:dm-mailer,代码行数:14,代码来源:Json.php

示例5: __construct

 /**
  * Creates an instance.
  *
  * @param UserInterface|array|null $options
  */
 public function __construct($options = null)
 {
     if ($options instanceof UserInterface) {
         $options = array('user' => $options);
     }
     parent::__construct($options);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:12,代码来源:UniqueGroupName.php

示例6: __construct

 /**
  * @param array                      $options
  * @param DataMapperManagerInterface $dataMapperManager
  */
 public function __construct(array $options = null, DataMapperManagerInterface $dataMapperManager = null)
 {
     $this->dataMapperManager = $dataMapperManager;
     if (!isset($options['finder']) && !isset($options['entity_class'])) {
         throw new Exception\InvalidArgumentException('No finder nor entity class provided');
     }
     if (isset($options['entity_class']) && $this->dataMapperManager) {
         $options['finder'] = $this->dataMapperManager->getDataMapperForEntity($options['entity_class']);
     }
     if (!is_object($options['finder']) && !is_callable($options['finder'])) {
         throw new Exception\InvalidArgumentException('Finder must be an object or a callable');
     }
     if (!isset($options['find_method'])) {
         $options['find_method'] = is_callable($options['finder']) ? '__invoke' : 'findByUuid';
     }
     if (!method_exists($options['finder'], $options['find_method'])) {
         throw new Exception\InvalidArgumentException(sprintf("'%s' method not found in '%s'", $options['find_method'], get_class($options['finder'])));
     }
     $this->setFindMethod($options['find_method']);
     $this->setFinder($options['finder']);
     if (isset($options['excluded'])) {
         $this->setExcluded($options['excluded']);
     }
     parent::__construct($options);
 }
开发者ID:stefanotorresi,项目名称:thorr-persistence,代码行数:29,代码来源:AbstractEntityValidator.php

示例7: __construct

 /**
  * Sets validator options
  *
  * @param  array|Traversable $options
  *
  * @throws InvalidArgumentException
  */
 public function __construct($options = null)
 {
     if (is_null($options)) {
         $options = [];
     }
     if ($options instanceof Traversable) {
         $options = ArrayUtils::iteratorToArray($options);
     }
     if (!array_key_exists('apiKey', $options)) {
         throw new InvalidArgumentException("Missing Kickbox API key");
     }
     if (!array_key_exists('strictMode', $options)) {
         $options['strictMode'] = false;
     }
     if (!array_key_exists('cacheAdapter', $options)) {
         $options['cacheAdapter'] = null;
     }
     if (!array_key_exists('logger', $options)) {
         $options['logger'] = null;
     }
     $this->setApiKey($options['apiKey']);
     $this->setStrictMode($options['strictMode']);
     $this->setCacheAdapter($options['cacheAdapter']);
     $this->setLogger($options['logger']);
     parent::__construct($options);
 }
开发者ID:byonchev,项目名称:zf2-kickbox,代码行数:33,代码来源:Kickbox.php

示例8: __construct

 /**
  * Sets validator options
  *
  * The array $files must be given in syntax of Zend_File_Transfer to be checked
  * If no files are given the $_FILES array will be used automatically.
  * NOTE: This validator will only work with HTTP POST uploads!
  *
  * @param  array|\Traversable $options Array of files in syntax of \Zend\File\Transfer\Transfer
  */
 public function __construct($options = array())
 {
     if (is_array($options) && !array_key_exists('files', $options)) {
         $options = array('files' => $options);
     }
     parent::__construct($options);
 }
开发者ID:totolouis,项目名称:ZF2-Auth,代码行数:16,代码来源:Upload.php

示例9: __construct

 /**
  * Sets validator options
  *
  * @param  null|string|Locale|array|Traversable $locale OPTIONAL
  * @return void
  */
 public function __construct($locale = null)
 {
     $options = array();
     if ($locale instanceof Traversable) {
         $locale = IteratorToArray::convert($locale);
     }
     if (is_array($locale)) {
         $options = $locale;
         if (array_key_exists('locale', $locale)) {
             $locale = $locale['locale'];
             unset($options['locale']);
         } else {
             $locale = null;
         }
     }
     if (empty($locale) && $locale !== false) {
         if (Registry::isRegistered('Zend_Locale')) {
             $locale = Registry::get('Zend_Locale');
         }
     }
     if ($locale !== null) {
         $this->setLocale($locale);
     }
     parent::__construct($options);
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:31,代码来源:Iban.php

示例10: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     if (is_array($options)) {
         $this->setOptions($options);
     }
 }
开发者ID:fagundes,项目名称:zff-base,代码行数:7,代码来源:AbstractCgc.php

示例11: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     if (is_array($options)) {
         if (array_key_exists("adapter", $options) && !empty($options['adapter'])) {
             $this->setAdapter($options['adapter']);
         } else {
             throw new Exception\InvalidArgumentException('Necessario informa Adapter.');
         }
         if (array_key_exists("tabela", $options) && !empty($options['tabela'])) {
             $this->tabela = $options['tabela'];
         } else {
             throw new Exception\InvalidArgumentException('Necessario informa a tabela do BD.');
         }
         if (array_key_exists("campo", $options) && !empty($options['campo'])) {
             $this->campo = $options['campo'];
         } else {
             throw new Exception\InvalidArgumentException('Necessario informa o campo a ser validado.');
         }
         if (array_key_exists('negar', $options) && count($options['negar']) > 0) {
             $this->negar = $options['negar'];
         }
         if (array_key_exists("camposExtra", $options) && count($options['camposExtra']) > 0) {
             $this->camposExtra = $options['camposExtra'];
         }
     }
 }
开发者ID:Rafael-Fontes,项目名称:CFP_EX,代码行数:27,代码来源:TesteUnicidade.php

示例12: __construct

 public function __construct($options = array())
 {
     parent::__construct($options);
     if (array_key_exists('valid_if_empty', $options)) {
         $this->validIfEmpty = $options['valid_if_empty'];
     }
 }
开发者ID:marcusvy,项目名称:mv-shopline-itau,代码行数:7,代码来源:CgcAbstract.php

示例13: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $options = $this->getOptions();
     //set default options if non set
     if (!isset($options[self::OPTION_MIN_LENGTH])) {
         $options[self::OPTION_MIN_LENGTH] = 8;
     }
     if (!isset($options[self::OPTION_REQUIRE_UPPER])) {
         $options[self::OPTION_REQUIRE_UPPER] = true;
     }
     if (!isset($options[self::OPTION_REQUIRE_LOWER])) {
         $options[self::OPTION_REQUIRE_LOWER] = true;
     }
     if (!isset($options[self::OPTION_REQUIRE_DIGIT])) {
         $options[self::OPTION_REQUIRE_DIGIT] = true;
     }
     if (!isset($options[self::OPTION_REQUIRE_SPECIAL_CHARACTERS])) {
         $options[self::OPTION_REQUIRE_SPECIAL_CHARACTERS] = true;
     }
     if (!isset($options[self::OPTION_SPECIAL_CHARACTERS])) {
         $options[self::OPTION_SPECIAL_CHARACTERS] = self::DEFAULT_SPECIAL_CHARS;
     }
     $minLength = $this->getOption(self::OPTION_MIN_LENGTH);
     $this->messageTemplates = array(self::LENGTH => "Password must be at least {$minLength} characters in length", self::UPPER => "Password must contain at least one uppercase letter", self::LOWER => "Password must contain at least one lowercase letter", self::DIGIT => "Password must contain at least one digit character", self::SPECIAL => "Password must contain at least one special character");
 }
开发者ID:vcomedia,项目名称:vco-zf-auth-acl,代码行数:26,代码来源:PasswordStrength.php

示例14: __construct

 /**
  * Sets default option values for this instance
  *
  * @param array|\Traversable $options
  */
 public function __construct($options = array())
 {
     if ($options instanceof Traversable) {
         $options = iterator_to_array($options);
     } elseif (!is_array($options)) {
         $options = func_get_args();
         $temp['uriHandler'] = array_shift($options);
         if (!empty($options)) {
             $temp['allowRelative'] = array_shift($options);
         }
         if (!empty($options)) {
             $temp['allowAbsolute'] = array_shift($options);
         }
         $options = $temp;
     }
     if (isset($options['uriHandler'])) {
         $this->setUriHandler($options['uriHandler']);
     }
     if (isset($options['allowRelative'])) {
         $this->setAllowRelative($options['allowRelative']);
     }
     if (isset($options['allowAbsolute'])) {
         $this->setAllowAbsolute($options['allowAbsolute']);
     }
     parent::__construct($options);
 }
开发者ID:Baft,项目名称:Zend-Form,代码行数:31,代码来源:Uri.php

示例15: __construct

 /**
  * Constructor
  *
  * @param  array|Traversable|int $options OPTIONAL
  */
 public function __construct($options = null)
 {
     if ($options instanceof Traversable) {
         $options = ArrayUtils::iteratorToArray($options);
     }
     if (!is_array($options)) {
         $options = func_get_args();
         $temp = array();
         if (!empty($options)) {
             $temp['type'] = array_shift($options);
         }
         $options = $temp;
     }
     if (is_array($options)) {
         if (!array_key_exists('type', $options)) {
             $detected = 0;
             $found = false;
             foreach ($options as $option) {
                 if (in_array($option, $this->constants)) {
                     $found = true;
                     $detected += array_search($option, $this->constants);
                 }
             }
             if ($found) {
                 $options['type'] = $detected;
             }
         }
     }
     parent::__construct($options);
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:35,代码来源:NotEmpty.php


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