2010-09-27 23:02:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Respect\Validation\Exceptions;
|
|
|
|
|
2010-11-30 16:36:04 +01:00
|
|
|
class DateException extends InvalidException
|
2010-09-27 23:02:30 +02:00
|
|
|
{
|
2010-10-18 10:18:46 +02:00
|
|
|
const MSG_INVALID_DATE = 'Date_1';
|
|
|
|
const MSG_INVALID_FORMAT = 'Date_2';
|
|
|
|
protected $messageTemplates = array(
|
|
|
|
self::MSG_INVALID_DATE => '%s is not a valid date reference',
|
|
|
|
self::MSG_INVALID_FORMAT => '%s is not a valid date in the %s format',
|
|
|
|
);
|
|
|
|
|
|
|
|
public function __construct($input, $format)
|
|
|
|
{
|
|
|
|
$code = is_null($format) ? static::MSG_INVALID_DATE : static::MSG_INVALID_FORMAT;
|
|
|
|
parent::__construct(
|
|
|
|
sprintf(
|
|
|
|
$this->getMessageTemplate($code), $input, $format
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-09-27 23:02:30 +02:00
|
|
|
}
|