Регистр файлов
This commit is contained in:
parent
4fd0187ea6
commit
c8958cbee0
83 changed files with 25 additions and 53 deletions
33
src/Validator/Rule/Time.php
Normal file
33
src/Validator/Rule/Time.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Проверка формата времени
|
||||
*/
|
||||
class Validator_Rule_Time extends Rule_Abstract
|
||||
{
|
||||
private $split = ":";
|
||||
|
||||
public function getErrorMsg()
|
||||
{
|
||||
return "Неверный формат времени";
|
||||
}
|
||||
|
||||
static function checktime($hour, $minute)
|
||||
{
|
||||
if ($hour > -1 && $hour < 24 && $minute > -1 && $minute < 60) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function isValid(Collection $container, $status = null)
|
||||
{
|
||||
$tmp = explode($this->split, $container->get($this->field), 2);
|
||||
if ($tmp) {
|
||||
if (self::checktime ($tmp[0], $tmp[1])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue