]> git.mxchange.org Git - friendica-addons.git/commitdiff
Fix PHPStan errors in statusnet addon
authorArt4 <art4@wlabs.de>
Wed, 26 Feb 2025 14:35:00 +0000 (14:35 +0000)
committerArt4 <art4@wlabs.de>
Wed, 26 Feb 2025 14:35:00 +0000 (14:35 +0000)
statusnet/library/codebirdsn.php
statusnet/library/statusnetoauth.php
statusnet/library/twitteroauth.php

index 9807d97f51d0b2754941a7123a1d2406b6bfb88a..bffca1637c9b3ca77fa149a832ef267ffe554c7a 100644 (file)
@@ -976,7 +976,7 @@ class CodebirdSN
      * @param string $method The method that has been called
      * @param string $reply  The actual reply, JSON-encoded or URL-encoded
      *
-     * @return array|object The parsed reply
+     * @return string|array|object The parsed reply
      */
     protected function _parseApiReply($method, $reply)
     {
index c32b2b4fb6c73a3c9ff1e6d4eea5df06ef2ee89b..da21be587f945ad2dab672d31e0c12c1307b21e0 100644 (file)
@@ -12,7 +12,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'twitteroauth.php';
  */
 class StatusNetOAuth extends TwitterOAuth
 {
-       function get_maxlength()
+       public function get_maxlength()
        {
                $config = $this->get($this->host . 'statusnet/config.json');
                if (empty($config)) {
@@ -21,27 +21,27 @@ class StatusNetOAuth extends TwitterOAuth
                return $config->site->textlimit;
        }
 
-       function accessTokenURL()
+       public function accessTokenURL()
        {
                return $this->host . 'oauth/access_token';
        }
 
-       function authenticateURL()
+       public function authenticateURL()
        {
                return $this->host . 'oauth/authenticate';
        }
 
-       function authorizeURL()
+       public function authorizeURL()
        {
                return $this->host . 'oauth/authorize';
        }
 
-       function requestTokenURL()
+       public function requestTokenURL()
        {
                return $this->host . 'oauth/request_token';
        }
 
-       function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL)
+       public function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL)
        {
                parent::__construct($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
                $this->host = $apipath;
@@ -52,9 +52,9 @@ class StatusNetOAuth extends TwitterOAuth
         *
         * Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica
         *
-        * @return array|object API results
+        * @return array|object|mixed API results
         */
-       function http($url, $method, $postfields = NULL)
+       public function http($url, $method, $postfields = NULL)
        {
                $this->http_info = [];
                $ci = curl_init();
index bf413d230d71ec9568292f1089357367954c95da..bab661956fc439f8727862cbdceba10e9d861000 100644 (file)
@@ -45,11 +45,11 @@ class TwitterOAuth
        public $http_header;
        /**
         * Contains the last HTTP request info
-        * @var string
+        * @var array
         */
        public $http_info;
 
-       /** @var OAuthToken */
+       /** @var OAuthToken|null */
        private $token;
        /** @var OAuthConsumer */
        private $consumer;
@@ -59,27 +59,27 @@ class TwitterOAuth
        /**
         * Set API URLS
         */
-       function accessTokenURL()
+       public function accessTokenURL()
        {
                return 'https://api.twitter.com/oauth/access_token';
        }
 
-       function authenticateURL()
+       public function authenticateURL()
        {
                return 'https://twitter.com/oauth/authenticate';
        }
 
-       function authorizeURL()
+       public function authorizeURL()
        {
                return 'https://twitter.com/oauth/authorize';
        }
 
-       function requestTokenURL()
+       public function requestTokenURL()
        {
                return 'https://api.twitter.com/oauth/request_token';
        }
 
-       function __construct($consumer_key, $consumer_secret, $oauth_token = null, $oauth_token_secret = null)
+       public function __construct($consumer_key, $consumer_secret, $oauth_token = null, $oauth_token_secret = null)
        {
                $this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
                $this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
@@ -96,7 +96,7 @@ class TwitterOAuth
         * @param callable $oauth_callback
         * @return array
         */
-       function getRequestToken($oauth_callback = null)
+       public function getRequestToken($oauth_callback = null)
        {
                $parameters = [];
                if (!empty($oauth_callback)) {
@@ -114,7 +114,7 @@ class TwitterOAuth
         *
         * @return string
         */
-       function getAuthorizeURL($token, $sign_in_with_twitter = TRUE)
+       public function getAuthorizeURL($token, $sign_in_with_twitter = TRUE)
        {
                if (is_array($token)) {
                        $token = $token['oauth_token'];
@@ -137,7 +137,7 @@ class TwitterOAuth
         *                "user_id" => "9436992",
         *                "screen_name" => "abraham")
         */
-       function getAccessToken($oauth_verifier = FALSE)
+       public function getAccessToken($oauth_verifier = FALSE)
        {
                $parameters = [];
                if (!empty($oauth_verifier)) {
@@ -162,7 +162,7 @@ class TwitterOAuth
         *                "screen_name" => "abraham",
         *                "x_auth_expires" => "0")
         */
-       function getXAuthToken($username, $password)
+       public function getXAuthToken($username, $password)
        {
                $parameters = [];
                $parameters['x_auth_username'] = $username;
@@ -182,7 +182,7 @@ class TwitterOAuth
         * @param array $parameters
         * @return mixed|string
         */
-       function get($url, $parameters = [])
+       public function get($url, $parameters = [])
        {
                $response = $this->oAuthRequest($url, 'GET', $parameters);
                if ($this->format === 'json' && $this->decode_json) {
@@ -199,7 +199,7 @@ class TwitterOAuth
         * @param array $parameters
         * @return mixed|string
         */
-       function post($url, $parameters = [])
+       public function post($url, $parameters = [])
        {
                $response = $this->oAuthRequest($url, 'POST', $parameters);
                if ($this->format === 'json' && $this->decode_json) {
@@ -216,7 +216,7 @@ class TwitterOAuth
         * @param array $parameters
         * @return mixed|string
         */
-       function delete($url, $parameters = [])
+       public function delete($url, $parameters = [])
        {
                $response = $this->oAuthRequest($url, 'DELETE', $parameters);
                if ($this->format === 'json' && $this->decode_json) {
@@ -234,7 +234,7 @@ class TwitterOAuth
         * @param array $parameters
         * @return mixed|string
         */
-       function oAuthRequest($url, $method, $parameters)
+       public function oAuthRequest($url, $method, $parameters)
        {
                if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
                        $url = "{$this->host}{$url}.{$this->format}";
@@ -258,9 +258,9 @@ class TwitterOAuth
         * @param string $url
         * @param string $method
         * @param mixed  $postfields
-        * @return string API results
+        * @return string|bool|mixed API results
         */
-       function http($url, $method, $postfields = null)
+       public function http($url, $method, $postfields = null)
        {
                $this->http_info = [];
                $ci = curl_init();
@@ -305,7 +305,7 @@ class TwitterOAuth
         * @param string $header
         * @return int
         */
-       function getHeader($ch, $header)
+       public function getHeader($ch, $header)
        {
                $i = strpos($header, ':');
                if (!empty($i)) {