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