From 4d2c88606be79d2acf5a2538ce11376bb1d7c313 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sat, 17 Dec 2022 17:51:20 +0000 Subject: [PATCH] Apply fixes from StyleCI --- Mastodon.php | 2 +- examples/reddit_bot.php | 4 ++-- examples/rss_bot.php | 4 ++-- examples/status_bot.php | 11 +++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Mastodon.php b/Mastodon.php index 28292a8..09b442e 100644 --- a/Mastodon.php +++ b/Mastodon.php @@ -25,7 +25,7 @@ { $headers = [ 'Authorization: Bearer '.$this->token, - 'Content-Type: multipart/form-data' + 'Content-Type: multipart/form-data', ]; $ch = curl_init(); diff --git a/examples/reddit_bot.php b/examples/reddit_bot.php index 2d1e889..ce308a1 100644 --- a/examples/reddit_bot.php +++ b/examples/reddit_bot.php @@ -11,7 +11,7 @@ $tagline = ' check out on '; if (!($jsonTxt = file_get_contents($feed_url))) { - die('Error loading the feed url'); + exit('Error loading the feed url'); } $json = json_decode($jsonTxt, true); @@ -38,7 +38,7 @@ array_push($statuses, $post); if (!$first_article) { - $myfile = fopen($file, 'w') or die('Unable to open file!'); + $myfile = fopen($file, 'w') or exit('Unable to open file!'); fwrite($myfile, $ts); fclose($myfile); $first_article = true; diff --git a/examples/rss_bot.php b/examples/rss_bot.php index 6165583..61a725e 100644 --- a/examples/rss_bot.php +++ b/examples/rss_bot.php @@ -10,7 +10,7 @@ $file = 'data.txt'; if (!($rss = simplexml_load_file($feed_url))) { - die('Error loading the feed url'); + exit('Error loading the feed url'); } $first_article = false; @@ -35,7 +35,7 @@ array_push($statuses, $post); if (!$first_article) { - $myfile = fopen($file, 'w') or die('Unable to open file!'); + $myfile = fopen($file, 'w') or exit('Unable to open file!'); fwrite($myfile, $ts); fclose($myfile); $first_article = true; diff --git a/examples/status_bot.php b/examples/status_bot.php index c1610ef..4f48be1 100644 --- a/examples/status_bot.php +++ b/examples/status_bot.php @@ -8,15 +8,14 @@ $privacy = 'private'; // "Direct" means sending message as a private message. Th $language = 'en'; // en for English, zh for Chinese, de for German etc. $statusText = 'This is a status'; -$statusData = array( -'status' => $statusText, -'privacy' => $privacy, -'language' => $language -); +$statusData = [ + 'status' => $statusText, + 'privacy' => $privacy, + 'language' => $language, +]; $mastodon = new MastodonAPI($token, $baseURL); $result = $mastodon->postStatus($statusData); // Activate the next line if you want to print the result of the query //var_dump($result); -?>