Example #1
0
 public function visitDate($data, Property\DateType $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\Date::getPattern() . '$/', $data);
         if ($result) {
             return true;
         }
     }
     throw new ValidationException($path . ' must be an valid full-date format (date-fullyear "-" date-month "-" date-mday) [RFC3339]');
 }