aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar mruac <ant8672@gmail.com> 2023-09-11 20:45:14 +0930
committerGravatar GitHub <noreply@github.com> 2023-09-11 13:15:14 +0200
commit3e1e96e477a26cf81582c16e9ef1edf399702b31 (patch)
treea54b19cad838cf26564ce445a29b87c04461ea99
parenta9cf1512e787d3dabb875fe033a0c08a4c274c65 (diff)
downloadrss-bridge-3e1e96e477a26cf81582c16e9ef1edf399702b31.tar.gz
rss-bridge-3e1e96e477a26cf81582c16e9ef1edf399702b31.tar.zst
rss-bridge-3e1e96e477a26cf81582c16e9ef1edf399702b31.zip
[PatreonBridge] resolve null coalescing issue (#3664)
* extend post presentation * applied phpcbf note: phpcs does not like long null coalescing chains * resolved phpcs * resolved github comment https://github.com/RSS-Bridge/rss-bridge/pull/3617/#issuecomment-1699568400 * . * lint SteamAppNewsBridge
-rw-r--r--bridges/PatreonBridge.php15
-rw-r--r--bridges/SteamAppNewsBridge.php3
2 files changed, 10 insertions, 8 deletions
diff --git a/bridges/PatreonBridge.php b/bridges/PatreonBridge.php
index 3d19cd81..d72bde20 100644
--- a/bridges/PatreonBridge.php
+++ b/bridges/PatreonBridge.php
@@ -132,8 +132,9 @@ class PatreonBridge extends BridgeAbstract
$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'];
@@ -146,15 +147,17 @@ class PatreonBridge extends BridgeAbstract
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;
diff --git a/bridges/SteamAppNewsBridge.php b/bridges/SteamAppNewsBridge.php
index 085e6978..81045800 100644
--- a/bridges/SteamAppNewsBridge.php
+++ b/bridges/SteamAppNewsBridge.php
@@ -41,8 +41,7 @@ class SteamAppNewsBridge extends BridgeAbstract
$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')