IsValid() публичный статический Метод

public static IsValid ( $p_value )
Пример #1
0
 public function setValue($p_value)
 {
     if (!MetaTime::IsValid($p_value)) {
         throw new InvalidValueException($p_value, MetaTime::GetTypeName());
     }
     $this->m_value = trim($p_value);
     $timeComponents = preg_split('/:/', $p_value);
     $this->m_hour = $timeComponents[0];
     $this->m_minute = $timeComponents[1];
     $this->m_second = isset($timeComponents[2]) ? $timeComponents[2] : 0;
 }
Пример #2
0
 public static function IsValid($p_value)
 {
     $p_value = trim($p_value);
     // now() is an value which have to be computed
     if (strtolower($p_value) == 'now()') {
         return true;
     }
     $datetimeParts = preg_split('/[\\s]+/', $p_value);
     $date = $datetimeParts[0];
     $time = isset($datetimeParts[1]) ? $datetimeParts[1] : '00:00:00';
     if (!MetaDate::IsValid($date)) {
         return false;
     }
     if (!MetaTime::IsValid($time)) {
         return false;
     }
     return true;
 }