ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
GetLastModified.php
Go to the documentation of this file.
1<?php
2
4
5use DateTime;
6use DateTimeZone;
7use Sabre\HTTP;
11
22class GetLastModified implements Element {
23
29 public $time;
30
36 function __construct($time) {
37
38 if ($time instanceof DateTime) {
39 $this->time = clone $time;
40 } else {
41 $this->time = new DateTime('@' . $time);
42 }
43
44 // Setting timezone to UTC
45 $this->time->setTimezone(new DateTimeZone('UTC'));
46
47 }
48
54 function getTime() {
55
56 return $this->time;
57
58 }
59
75 function xmlSerialize(Writer $writer) {
76
77 $writer->write(
78 HTTP\Util::toHTTPDate($this->time)
79 );
80
81 }
82
104 static function xmlDeserialize(Reader $reader) {
105
106 return
107 new self(new DateTime($reader->parseInnerTree()));
108
109 }
110}
An exception for terminatinating execution or to throw for unit testing.
This property represents the {DAV:}getlastmodified property.
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
xmlSerialize(Writer $writer)
The serialize method is called during xml writing.
static toHTTPDate(\DateTime $dateTime)
Transforms a DateTime object to HTTP's most common date format.
Definition: Util.php:69
The Reader class expands upon PHP's built-in XMLReader.
Definition: Reader.php:20
The XML Writer class.
Definition: Writer.php:31
write($value)
Writes a value to the output stream.
Definition: Writer.php:98
This is the XML element interface.
Definition: Element.php:18