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


PHP Validator::init方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     if ($this->message === null) {
         $this->message = Yii::t('yii', '{attribute} is not a valid mac-address.');
     }
 }
开发者ID:vakorovin,项目名称:yii2-macaddress-validator,代码行数:7,代码来源:MacaddressValidator.php

示例2: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (is_array($this->length)) {
         if (isset($this->length[0])) {
             $this->min = $this->length[0];
         }
         if (isset($this->length[1])) {
             $this->max = $this->length[1];
         }
         $this->length = null;
     }
     if ($this->encoding === null) {
         $this->encoding = Yii::$app->charset;
     }
     if ($this->message === null) {
         $this->message = Yii::t('yii', '{attribute} must be a string.');
     }
     if ($this->min !== null && $this->tooShort === null) {
         $this->tooShort = Yii::t('yii', '{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.');
     }
     if ($this->max !== null && $this->tooLong === null) {
         $this->tooLong = Yii::t('yii', '{attribute} should contain at most {max, number} {max, plural, one{character} other{characters}}.');
     }
     if ($this->length !== null && $this->notEqual === null) {
         $this->notEqual = Yii::t('yii', '{attribute} should contain {length, number} {length, plural, one{character} other{characters}}.');
     }
 }
开发者ID:phpsong,项目名称:DeviceManagementSystem,代码行数:31,代码来源:StringValidator.php

示例3: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->message === null) {
         $this->message = Yii::t('wb_correios', 'CEP invalid.');
     }
 }
开发者ID:wbraganca,项目名称:yii2-correios,代码行数:10,代码来源:CepValidator.php

示例4: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->message === null) {
         $this->message = $this->requiredValue === null ? Yii::t('yii', '{attribute} cannot be blank.') : Yii::t('yii', '{attribute} must be "{requiredValue}".');
     }
 }
开发者ID:phaniapsr,项目名称:yiicomm,代码行数:10,代码来源:RequiredValidator.php

示例5: init

 public function init()
 {
     parent::init();
     if ($this->message === null) {
         $this->message = \Yii::t('errors', 'Wrong phone format.');
     }
 }
开发者ID:carono,项目名称:yii2-components,代码行数:7,代码来源:PhoneValidator.php

示例6: init

 public function init()
 {
     if (!$this->message) {
         $this->message = \Yii::t('yii', 'The format of {attribute} is invalid.');
     }
     parent::init();
 }
开发者ID:nirodg,项目名称:yii2-phone-input,代码行数:7,代码来源:PhoneInputValidator.php

示例7: init

 /**
  * Инициализация
  */
 public function init()
 {
     parent::init();
     if (empty($this->message)) {
         $this->message = Yii::t('main', 'Wrong uuid value');
     }
 }
开发者ID:internet-design,项目名称:yii2-svk-common,代码行数:10,代码来源:UuidValidator.php

示例8: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->message) {
         $this->message = Yii::t('main', 'Wrong JSON format');
     }
 }
开发者ID:internet-design,项目名称:yii2-svk-common,代码行数:10,代码来源:JsonValidator.php

示例9: init

 function init()
 {
     parent::init();
     if (!isset(Yii::$app->i18n->translations['yii2-rut'])) {
         Yii::$app->i18n->translations['yii2-rut'] = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => dirname(__FILE__) . '/messages'];
     }
 }
开发者ID:sateler,项目名称:yii2-rut,代码行数:7,代码来源:RutValidator.php

示例10: init

 public function init()
 {
     parent::init();
     if (!$this->message) {
         $this->message = Yii::t('app', '{attribute} is not a valid number.');
     }
 }
开发者ID:indicalabs,项目名称:yii2-phone,代码行数:7,代码来源:IntlTelNumberValidator.php

示例11: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->message) {
         $this->message = \Yii::t('app', 'Given value has bad format');
     }
 }
开发者ID:dlds,项目名称:yii2-components,代码行数:10,代码来源:ISOValidator.php

示例12: init

 public function init()
 {
     parent::init();
     $this->_msgCat = 'creditcard';
     $this->initI18N(__DIR__);
     $this->message = Yii::t('creditcard', 'Expiry is invalid.');
 }
开发者ID:andrewblake1,项目名称:yii2-credit-card,代码行数:7,代码来源:CCExpiryValidator.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->message === null) {
         $this->message = \Yii::t('app', 'Неправильный формат телефона, ожидается формат +79001234567');
     }
 }
开发者ID:extpoint,项目名称:yii2-core,代码行数:10,代码来源:PhoneValidator.php

示例14: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->message === null) {
         $this->message = Module::t('ERROR_VALIDATE_ARRAY');
     }
 }
开发者ID:bupy7,项目名称:yii2-snotify,代码行数:10,代码来源:IsArray.php

示例15: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->className)) {
         throw InvalidConfigException('Property "className" must be provided');
     }
 }
开发者ID:jlorente,项目名称:yii2-validators,代码行数:10,代码来源:IntegrityValidator.php


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