Exemple #1
0
 public function visitDateTime($data, Property\DateTimeType $property, $path)
 {
     $this->assertRequired($data, $property, $path);
     if ($data === null) {
         return true;
     } elseif ($data instanceof \DateTime) {
         return true;
     } elseif (is_string($data)) {
         $result = preg_match('/^' . DateTime::getPattern() . '$/', $data);
         if ($result) {
             return true;
         }
     }
     throw new ValidationException($path . ' must be an valid date-time format (full-date "T" full-time) [RFC3339]');
 }