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