本文整理汇总了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.');
}
}
示例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}}.');
}
}
示例3: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if ($this->message === null) {
$this->message = Yii::t('wb_correios', 'CEP invalid.');
}
}
示例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}".');
}
}
示例5: init
public function init()
{
parent::init();
if ($this->message === null) {
$this->message = \Yii::t('errors', 'Wrong phone format.');
}
}
示例6: init
public function init()
{
if (!$this->message) {
$this->message = \Yii::t('yii', 'The format of {attribute} is invalid.');
}
parent::init();
}
示例7: init
/**
* Инициализация
*/
public function init()
{
parent::init();
if (empty($this->message)) {
$this->message = Yii::t('main', 'Wrong uuid value');
}
}
示例8: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (!$this->message) {
$this->message = Yii::t('main', 'Wrong JSON format');
}
}
示例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'];
}
}
示例10: init
public function init()
{
parent::init();
if (!$this->message) {
$this->message = Yii::t('app', '{attribute} is not a valid number.');
}
}
示例11: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (!$this->message) {
$this->message = \Yii::t('app', 'Given value has bad format');
}
}
示例12: init
public function init()
{
parent::init();
$this->_msgCat = 'creditcard';
$this->initI18N(__DIR__);
$this->message = Yii::t('creditcard', 'Expiry is invalid.');
}
示例13: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if ($this->message === null) {
$this->message = \Yii::t('app', 'Неправильный формат телефона, ожидается формат +79001234567');
}
}
示例14: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if ($this->message === null) {
$this->message = Module::t('ERROR_VALIDATE_ARRAY');
}
}
示例15: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (empty($this->className)) {
throw InvalidConfigException('Property "className" must be provided');
}
}