Added vendor/ directory for Composer's installed files
This commit is contained in:
29
vendor/alexgarrett/violin/src/Rules/MaxRule.php
vendored
Executable file
29
vendor/alexgarrett/violin/src/Rules/MaxRule.php
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Violin\Rules;
|
||||
|
||||
use Violin\Contracts\RuleContract;
|
||||
|
||||
class MaxRule implements RuleContract
|
||||
{
|
||||
public function run($value, $input, $args)
|
||||
{
|
||||
$number = isset($args[1]) && $args[1] === 'number';
|
||||
|
||||
if ($number) {
|
||||
return (float) $value <= (float) $args[0];
|
||||
}
|
||||
|
||||
return mb_strlen($value) <= (int) $args[0];
|
||||
}
|
||||
|
||||
public function error()
|
||||
{
|
||||
return '{field} must be a maximum of {$0}.';
|
||||
}
|
||||
|
||||
public function canSkip()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user