2010-12-05 21:26:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Respect\Validation\Exceptions;
|
|
|
|
|
|
|
|
class MaxException extends ValidationException
|
|
|
|
{
|
2011-02-08 23:10:58 +01:00
|
|
|
const INCLUSIVE = 1;
|
2011-01-31 01:17:06 +01:00
|
|
|
|
2010-12-05 21:26:04 +01:00
|
|
|
public static $defaultTemplates = array(
|
2011-02-08 23:10:58 +01:00
|
|
|
self::STANDARD => '%s must be lower than %s',
|
|
|
|
self::INCLUSIVE => '%s must be lower than %s (inclusive)',
|
2010-12-05 21:26:04 +01:00
|
|
|
);
|
2011-01-31 01:17:06 +01:00
|
|
|
|
2011-02-08 23:10:58 +01:00
|
|
|
public function cnofigure($name, $max, $inclusive)
|
|
|
|
{
|
|
|
|
return parent::configure($name, ValidationException::stringify($max),
|
|
|
|
$inclusive);//TODO find a better way
|
|
|
|
}
|
|
|
|
|
|
|
|
public function chooseTemplate($name, $max, $inclusive)
|
2010-12-07 20:17:43 +01:00
|
|
|
{
|
2011-02-07 02:12:41 +01:00
|
|
|
return $inclusive ? static::INCLUSIVE : static::STANDARD;
|
2010-12-07 20:17:43 +01:00
|
|
|
}
|
2010-12-05 21:26:04 +01:00
|
|
|
|
|
|
|
}
|