mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 23:59:51 +01:00
25 lines
No EOL
783 B
PHP
25 lines
No EOL
783 B
PHP
<?php
|
|
|
|
namespace Respect\Validation\Exceptions;
|
|
|
|
class AlphaException extends InvalidException
|
|
{
|
|
const MSG_NOT_ALPHA = 'Alpha_1';
|
|
const MSG_NOT_ALPHA_ADDITIONAL = 'Alpha_2';
|
|
protected $messageTemplates = array(
|
|
self::MSG_NOT_ALPHA => '"%s" does not contains only letters',
|
|
self::MSG_NOT_ALPHA_ADDITIONAL => '"%s" does not contains only letters (including "%s")'
|
|
);
|
|
|
|
public function __construct($input, $additionalChars='')
|
|
{
|
|
$code = empty($additionalChars) ? self::MSG_NOT_ALPHA : self::MSG_NOT_ALPHA_ADDITIONAL;
|
|
parent::__construct(
|
|
sprintf(
|
|
$this->getMessageTemplate($code),
|
|
$this->getStringRepresentation($input), $additionalChars
|
|
)
|
|
);
|
|
}
|
|
|
|
} |