respect-validation/library/Respect/Validation/Exceptions/AlnumException.php
Alexandre Gomes Gaigalas 248fbdcf4f More stable Exceptions API
2010-12-03 19:36:46 -02:00

22 lines
630 B
PHP

<?php
namespace Respect\Validation\Exceptions;
class AlnumException extends ValidationException
{
const INVALID_ALNUM = 'Alnum_1';
const INVALID_ALNUM_CHARS = 'Alnum_2';
public static $defaultTemplates = array(
self::INVALID_ALNUM => '"%s" does not contain only letters and digits',
self::INVALID_ALNUM_CHARS => '"%s" does not contain only letters, digits and "%s"'
);
public function chooseTemplate($input, $additionalCharacters=null)
{
if (empty($additionalCharacters))
return self::INVALID_ALNUM;
else
return self::INVALID_ALNUM_CHARS;
}
}