Skip to content

Commit

Permalink
fixed broadcast adapter function in Anime model
Browse files Browse the repository at this point in the history
  • Loading branch information
pushrbx committed Jun 23, 2024
1 parent c628007 commit 896c68f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Anime.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Jikan\Jikan;
use Jikan\Request\Anime\AnimeRequest;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use MongoDB\Model\BSONDocument;

class Anime extends JikanApiSearchableModel
{
Expand Down Expand Up @@ -407,7 +408,7 @@ public function getSearchIndexSortBy(): array|null
];
}

private function adaptBroadcastValue(array|string|null $broadcast): array
private function adaptBroadcastValue(array|string|null|BSONDocument $broadcast): array
{
$null_value = [
'day' => null,
Expand All @@ -423,6 +424,10 @@ private function adaptBroadcastValue(array|string|null $broadcast): array
return $broadcast;
}

if ($broadcast instanceof BSONDocument) {
return $broadcast->getArrayCopy();

Check warning on line 428 in app/Anime.php

View check run for this annotation

Codecov / codecov/patch

app/Anime.php#L427-L428

Added lines #L427 - L428 were not covered by tests
}

if (!preg_match('~(.*) at (.*) \(~', $broadcast, $matches)) {
return [
'day' => null,
Expand Down

0 comments on commit 896c68f

Please sign in to comment.