/** * @see sfValidatorBase */ protected function doClean($value) { $clean = (string) $value; if (!DateTimeUtils::validTimeString($value)) { throw new sfValidatorError($this, 'invalid'); } $clean = DateTimeUtils::formatTime(DateTimeUtils::parseTime($value)); $cleanedSeconds = DateTimeUtils::getTimeSeconds($value); if ($cleanedSeconds < DateTimeUtils::getTimeSeconds($this->getOption('startTime'))) { throw new sfValidatorError($this, 'start_time', array('value' => $clean, 'start_time' => $this->getOption('start_time'))); } if ($cleanedSeconds > DateTimeUtils::getTimeSeconds($this->getOption('endTime'))) { throw new sfValidatorError($this, 'end_time', array('value' => $clean, 'end_time' => $this->getOption('end_time'))); } return $clean; }