Skip to content

Commit

Permalink
fix: Fixed early access of AbstractEmbedFinder::$feed
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Nov 26, 2024
1 parent 19561ee commit ee3b935
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/MediaFinders/AbstractEmbedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
abstract class AbstractEmbedFinder implements EmbedFinderInterface
{
protected array|\SimpleXMLElement|null $feed;
protected array|\SimpleXMLElement|null $feed = null;
protected string $embedId;
protected ?string $key = null;

Expand Down Expand Up @@ -93,11 +93,8 @@ public function exists(): bool
public function getFeed(): array|\SimpleXMLElement|null
{
if (null === $this->feed) {
$rawFeed = $this->getMediaFeed();
if ($rawFeed instanceof StreamInterface) {
$rawFeed = $rawFeed->getContents();
}
if (null !== $rawFeed) {
$rawFeed = $this->getMediaFeed()->getContents();
if (null !== $rawFeed && \json_validate($rawFeed)) {
$feed = json_decode($rawFeed, true);
if (is_array($feed)) {
$this->feed = $feed;
Expand Down

0 comments on commit ee3b935

Please sign in to comment.