Skip to content

Commit

Permalink
[PatreonBridge] resolve null coalescing issue (RSS-Bridge#3664)
Browse files Browse the repository at this point in the history
* extend post presentation

* applied phpcbf

note: phpcs does not like long null coalescing chains

* resolved phpcs

* resolved github comment RSS-Bridge#3617

* .

* lint SteamAppNewsBridge
  • Loading branch information
mruac authored and dvikan committed Sep 12, 2023
1 parent 738146f commit 9c12a33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 9 additions & 6 deletions bridges/PatreonBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ public function collectData()
$audio = $this->findInclude($posts, 'media', $id)->attributes ?? null;
}
}
$thumbnail = $post->attributes->thumbnail->large ?? $post->attributes->thumbnail->url;
$thumbnail = $thumbnail ?? $post->attributes->image->thumb_url;
$thumbnail = $post->attributes->thumbnail->large ?? null;
$thumbnail = $thumbnail ?? $post->attributes->thumbnail->url ?? null;
$thumbnail = $thumbnail ?? $post->attributes->image->thumb_url ?? null;
$thumbnail = $thumbnail ?? $post->attributes->image->url;
$audio_filename = $audio->file_name ?? $item['title'];
$download_url = $audio->download_url ?? $item['uri'];
Expand All @@ -146,15 +147,17 @@ public function collectData()
break;

case 'video_embed':
$thumbnail = $post->attributes->thumbnail->large ?? $post->attributes->thumbnail->url;
$thumbnail = $thumbnail ?? $post->attributes->image->thumb_url;
$thumbnail = $post->attributes->thumbnail->large ?? null;
$thumbnail = $thumbnail ?? $post->attributes->thumbnail->url ?? null;
$thumbnail = $thumbnail ?? $post->attributes->image->thumb_url ?? null;
$thumbnail = $thumbnail ?? $post->attributes->image->url;
$item['content'] .= "<p><a href=\"{$item['uri']}\">🎬 {$item['title']}<br><img src=\"{$thumbnail}\"></a></p>";
break;

case 'video_external_file':
$thumbnail = $post->attributes->thumbnail->large ?? $post->attributes->thumbnail->url;
$thumbnail = $thumbnail ?? $post->attributes->image->thumb_url;
$thumbnail = $post->attributes->thumbnail->large ?? null;
$thumbnail = $thumbnail ?? $post->attributes->thumbnail->url ?? null;
$thumbnail = $thumbnail ?? $post->attributes->image->thumb_url ?? null;
$thumbnail = $thumbnail ?? $post->attributes->image->url;
$item['content'] .= "<p><a href=\"{$item['uri']}\">🎬 {$item['title']}<br><img src=\"{$thumbnail}\"></a></p>";
break;
Expand Down
3 changes: 1 addition & 2 deletions bridges/SteamAppNewsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public function collectData()
$apiTarget = 'https://api.steampowered.com/ISteamNews/GetNewsForApp/v2/';
// Example with params: https://api.steampowered.com/ISteamNews/GetNewsForApp/v2/?appid=730&maxlength=0&count=20
// More info at dev docs https://partner.steamgames.com/doc/webapi/ISteamNews
$url =
$apiTarget
$url = $apiTarget
. '?appid=' . $this->getInput('appid')
. '&maxlength=' . $this->getInput('maxlength')
. '&count=' . $this->getInput('count')
Expand Down

0 comments on commit 9c12a33

Please sign in to comment.