respect-validation/library/Rules/Max.php
Henrique Moody da193b75e0 Use PSR-2 standard
Most changes was made by php-cs-fixer.
Also removes unused `RecursiveTreeIterator` class.
2015-01-08 00:44:12 -02:00

23 lines
475 B
PHP

<?php
namespace Respect\Validation\Rules;
class Max extends AbstractRule
{
public $maxValue;
public $inclusive;
public function __construct($maxValue, $inclusive = false)
{
$this->maxValue = $maxValue;
$this->inclusive = $inclusive;
}
public function validate($input)
{
if ($this->inclusive) {
return $input <= $this->maxValue;
} else {
return $input < $this->maxValue;
}
}
}