ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
GetLastModified.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAV\Xml\Property;
4 
5 use DateTime;
6 use DateTimeZone;
7 use Sabre\HTTP;
11 
22 class 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 }
parseInnerTree(array $elementMap=null)
Parses all elements below the current element.
Definition: Reader.php:129
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
static toHTTPDate(\DateTime $dateTime)
Transforms a DateTime object to HTTP&#39;s most common date format.
Definition: Util.php:69
The Reader class expands upon PHP&#39;s built-in XMLReader.
Definition: Reader.php:20
xmlSerialize(Writer $writer)
The serialize method is called during xml writing.
This property represents the {DAV:}getlastmodified property.
This is the XML element interface.
Definition: Element.php:18
write($value)
Writes a value to the output stream.
Definition: Writer.php:98
The XML Writer class.
Definition: Writer.php:31