Skip to content

Commit

Permalink
Implement Episode::fromArray. Bugfix EpisodeGuid::fromArray value. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
eruraindil authored Jul 1, 2024
1 parent 1538950 commit 83d9708
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Values/Episode.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ final public function __construct(
) {
}

public static function fromArray(array $data): static
{
return new static(
title: Arr::get($data, 'title'),
guid: EpisodeGuid::fromArray(Arr::get($data, 'guid')),
enclosure: Enclosure::fromArray(Arr::get($data, 'enclosure')),
metadata: EpisodeMetadata::fromArray(Arr::get($data, 'metadata', [])),
);
}

public static function fromXmlElement(Element $item): static
{
try {
Expand Down
2 changes: 1 addition & 1 deletion src/Values/EpisodeGuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function fromXmlElement(Element $element): static
public static function fromArray(array $data): static
{
return new static(
value: Arr::get($data, 'guid'),
value: Arr::get($data, 'value'),
isPermaLink: Arr::get($data, 'is_perma_link'),
);
}
Expand Down

0 comments on commit 83d9708

Please sign in to comment.