mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
21 lines
434 B
PHP
21 lines
434 B
PHP
<?php
|
|
namespace Respect\Validation\Rules;
|
|
|
|
class True extends AbstractRule
|
|
{
|
|
public function validate($input)
|
|
{
|
|
if (! is_string($input) || is_numeric($input)) {
|
|
return ($input == true);
|
|
}
|
|
|
|
$validValues = array(
|
|
'on',
|
|
'true',
|
|
'yes',
|
|
);
|
|
$filteredInput = strtolower($input);
|
|
|
|
return in_array($filteredInput, $validValues);
|
|
}
|
|
}
|