diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php index 24bdefe1..93813004 100644 --- a/actions/DisplayAction.php +++ b/actions/DisplayAction.php @@ -32,7 +32,7 @@ class DisplayAction implements ActionInterface return new Response('', 304, ['last-modified' => $modificationTimeGMT . 'GMT']); } } - return $cachedResponse; + return $cachedResponse->withHeader('rss-bridge', 'This is a cached response'); } if (!$bridgeName) { diff --git a/bridges/MediapartBlogsBridge.php b/bridges/MediapartBlogsBridge.php index fa8c3d5f..d1e1c3c9 100644 --- a/bridges/MediapartBlogsBridge.php +++ b/bridges/MediapartBlogsBridge.php @@ -35,7 +35,12 @@ class MediapartBlogsBridge extends BridgeAbstract $item['title'] = $item_title->innertext; $item['uri'] = self::BASE_URI . trim($item_title->href); - $item['author'] = $element->find('.author .subscriber', 0)->innertext; + + $author = $element->find('.author .subscriber', 0); + if ($author) { + $item['author'] = $author->innertext; + } + $item['content'] = $item_divs[count($item_divs) - 2] . $item_divs[count($item_divs) - 1]; $item['timestamp'] = strtotime($element->find('.author time', 0)->datetime); diff --git a/lib/FeedItem.php b/lib/FeedItem.php index bd37f119..fc4549a7 100644 --- a/lib/FeedItem.php +++ b/lib/FeedItem.php @@ -178,7 +178,6 @@ class FeedItem } else { $this->author = $author; } - return $this; } public function getContent(): ?string @@ -284,7 +283,6 @@ class FeedItem } else { $this->misc[$name] = $value; } - return $this; } public function toArray(): array diff --git a/lib/http.php b/lib/http.php index e4f9bf48..39f0c727 100644 --- a/lib/http.php +++ b/lib/http.php @@ -331,7 +331,14 @@ final class Response return array_pop($header); } - public function withBody(string $body): Response + public function withHeader(string $name, string $value): self + { + $clone = clone $this; + $clone->headers[$name] = [$value]; + return $clone; + } + + public function withBody(string $body): self { $clone = clone $this; $clone->body = $body;