コード例 #1
0
 private function sayDateLiteral(RdfWriter $writer, TimeValue $value)
 {
     $dateValue = $this->dateCleaner->getStandardValue($value);
     if (!is_null($dateValue)) {
         // XXX: type should perhaps depend on precision.
         $writer->value($dateValue, 'xsd', 'dateTime');
     } else {
         $writer->value($value->getTime());
     }
 }
 /**
  * @dataProvider getDatesXSD11
  */
 public function testCleanDateXSD11($date, $calendar, $expected, $precision = TimeValue::PRECISION_SECOND)
 {
     $julianCleaner = new JulianDateTimeValueCleaner();
     $gregorianCleaner = new DateTimeValueCleaner(true);
     $value = new TimeValue($date, 0, 0, 0, $precision, $calendar);
     $result = $julianCleaner->getStandardValue($value);
     $this->assertEquals($expected, $result);
     if ($calendar == TimeValue::CALENDAR_GREGORIAN) {
         $result = $gregorianCleaner->getStandardValue($value);
         $this->assertEquals($expected, $result);
     }
 }