本文整理汇总了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();
}
示例2: init
public function init()
{
if (!is_array($this->range)) {
throw new \InvalidArgumentException($this->rangeErrorMessage);
}
parent::init();
}
示例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();
}
示例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();
}
示例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();
}