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


PHP AbstractValidator::init方法代码示例

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


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

示例1: init

 public function init()
 {
     if ($this->enableIDN && !function_exists('idn_to_ascii')) {
         $this->addError($this->intlErrorMessage);
     }
     parent::init();
 }
开发者ID:yurybykov,项目名称:valify,代码行数:7,代码来源:UrlValidator.php

示例2: init

 public function init()
 {
     if (!is_array($this->range)) {
         throw new \InvalidArgumentException($this->rangeErrorMessage);
     }
     parent::init();
 }
开发者ID:yurybykov,项目名称:valify,代码行数:7,代码来源:RangeValidator.php

示例3: init

 public function init()
 {
     if ($this->message === null) {
         switch ($this->operator) {
             case '==':
                 $this->message = '{compareAttribute} must be repeated exactly.';
                 break;
             case '===':
                 $this->message = '{compareAttribute} must be repeated exactly.';
                 break;
             case '!=':
                 $this->message = '{compareAttribute} must not be equal to "{compareValue}".';
                 break;
             case '!==':
                 $this->message = '{compareAttribute} must not be equal to "{compareValue}".';
                 break;
             case '>':
                 $this->message = '{compareAttribute} must be greater than "{compareValue}".';
                 break;
             case '>=':
                 $this->message = '{compareAttribute} must be greater than or equal to "{compareValue}".';
                 break;
             case '<':
                 $this->message = '{compareAttribute} must be less than "{compareValue}".';
                 break;
             case '<=':
                 $this->message = '{compareAttribute} must be less than or equal to "{compareValue}".';
                 break;
             default:
                 $this->addError('Unknown operator: {operator}', ['{operator}' => $this->operator]);
         }
     }
     parent::init();
 }
开发者ID:yurybykov,项目名称:valify,代码行数:34,代码来源:CompareValidator.php

示例4: init

 public function init()
 {
     if ($this->edsn) {
         $this->parseEDSN();
     }
     if (!$this->table || !$this->column) {
         throw new \UnexpectedValueException('Table and column must be specified');
     }
     if (!is_string($this->table) || !is_string($this->column)) {
         throw new \UnexpectedValueException('Table and column must be set as string');
     }
     mysqli_report(MYSQLI_REPORT_STRICT);
     $mysqli = new \mysqli($this->host, $this->user, $this->pass, $this->dbname);
     if ($mysqli->connect_errno) {
         throw new \mysqli_sql_exception(printf("Connection error: %s\n", $mysqli->connect_error));
     }
     $this->conn = $mysqli;
     parent::init();
 }
开发者ID:yurybykov,项目名称:valify,代码行数:19,代码来源:UniqueValidator.php

示例5: init

 public function init()
 {
     if (!is_array($this->extensions)) {
         $this->extensions = preg_split('/[\\s,]+/', strtolower($this->extensions), -1, PREG_SPLIT_NO_EMPTY);
     } else {
         $this->extensions = array_map('strtolower', $this->extensions);
     }
     if (!is_array($this->mimeTypes)) {
         $this->mimeTypes = preg_split('/[\\s,]+/', strtolower($this->mimeTypes), -1, PREG_SPLIT_NO_EMPTY);
     } else {
         $this->mimeTypes = array_map('strtolower', $this->mimeTypes);
     }
     $uploadMaxFileSize = $this->sizeToBytes(ini_get('upload_max_filesize'));
     if (isset($_POST['MAX_FILE_SIZE']) && $_POST['MAX_FILE_SIZE'] > 0 && $_POST['MAX_FILE_SIZE'] < $uploadMaxFileSize) {
         $uploadMaxFileSize = (int) $_POST['MAX_FILE_SIZE'];
     }
     if ($this->maxSize == null || $this->maxSize > $uploadMaxFileSize) {
         $this->maxSize = $uploadMaxFileSize;
     }
     parent::init();
 }
开发者ID:yurybykov,项目名称:valify,代码行数:21,代码来源:FileValidator.php


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