contentType) ?? ""; if ($type && !in_array($type->essence, self::MIME_TYPES)) { throw new Exception("notHTMLType"); } if ($type && $type->essence === "application/xhtml+xml") { $this->document = new \DOMDocument; if (!$this->document->loadXML($this->data, self::LIBXML_OPTIONS)) { // ignore XML parsing errors; we will reparse as HTML in this case $this->document = null; } elseif ($this->document->documentElement->namespaceURI !== XPath::NS['html']) { throw new Exception("notXHTML"); } } if (!$this->document) { $this->document = new \DOMDocument; if (!$this->document->loadHTML($this->data, self::LIBXML_OPTIONS)) { throw new Exception("notHTML"); // @codeCoverageIgnore } } $this->document->documentURI = $this->url; $this->xpath = new \DOMXPath($this->document); $this->subject = $this->fetchElement("h-feed", "//*"); if (!$this->subject) { throw new Exception("notHTMLFeed"); } $feed->meta->url = $this->url; $feed->format = "h-feed"; $feed->version = "1"; return $feed; } /** {@inheritDoc} * * h-feeds do not have IDs, so this is always null. */ public function getId(): ?string { return null; } public function getUrl(): ?Url { return null; } public function getTitle(): ?Text { return null; } public function getLink(): ?Url { return null; } public function getSummary(): ?Text { return null; } public function getDateModified(): ?Date { return null; } public function getIcon(): ?Url { return null; } public function getImage(): ?Url { return null; } public function getCategories(): CategoryCollection { return new CategoryCollection; } public function getPeople(): PersonCollection { return new PersonCollection; } public function getEntries(FeedStruct $feed): array { return []; } public function getSchedule(): Schedule { return new Schedule; } }