BaguettePHP/mastodon-api

View on GitHub
src/Client.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '70', column '42').
Open

            $this->api_http_client = new \GuzzleHttp\Client([
Severity: Minor
Found in src/Client.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method getRequestAPIOptions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $user_agent = sprintf('%s; %s', self::USER_AGENT, \GuzzleHttp\default_user_agent());
        }
Severity: Minor
Found in src/Client.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Return type of requestAPI() is undeclared type \Psr\Http\Message\ResponseInterface
Open

    public function requestAPI($method, $path, array $options, SessionStorage $session)
Severity: Minor
Found in src/Client.php by phan

Parameter $client has undeclared type \GuzzleHttp\Client (Did you mean class \Baguette\Mastodon\Client)
Open

    public function setAPIHttpClient(\GuzzleHttp\Client $client)
Severity: Minor
Found in src/Client.php by phan

Call to method __construct from undeclared class \GuzzleHttp\Client (Did you mean class \Baguette\Mastodon\Client)
Open

            $this->api_http_client = new \GuzzleHttp\Client([
Severity: Critical
Found in src/Client.php by phan

Property \Baguette\Mastodon\Client->oauth_http_client has undeclared type \GuzzleHttp\Client (Did you mean class \Baguette\Mastodon\Client)
Open

    private $oauth_http_client;
Severity: Minor
Found in src/Client.php by phan

Return type of getAPIHttpClient() is undeclared type \GuzzleHttp\Client (Did you mean class \Baguette\Mastodon\Client)
Open

    private function getAPIHttpClient()
Severity: Minor
Found in src/Client.php by phan

Possibly zero references to use statement for classlike/namespace Mastodon (\Baguette\Mastodon)
Open

use Baguette\Mastodon;
Severity: Minor
Found in src/Client.php by phan

Call to undeclared function \GuzzleHttp\default_user_agent()
Open

            $user_agent = sprintf('%s; %s; %s', self::USER_AGENT, $this->client_name, \GuzzleHttp\default_user_agent());
Severity: Critical
Found in src/Client.php by phan

Property \Baguette\Mastodon\Client->api_http_client has undeclared type \GuzzleHttp\Client (Did you mean class \Baguette\Mastodon\Client)
Open

    private $api_http_client;
Severity: Minor
Found in src/Client.php by phan

Call to method request from undeclared class \GuzzleHttp\Client (Did you mean class \Baguette\Mastodon\Client)
Open

        return $this->getAPIHttpClient()->request($method, $path, $request_options);
Severity: Critical
Found in src/Client.php by phan

Call to undeclared function \GuzzleHttp\default_user_agent()
Open

            $user_agent = sprintf('%s; %s', self::USER_AGENT, \GuzzleHttp\default_user_agent());
Severity: Critical
Found in src/Client.php by phan

There are no issues that match your filters.

Category
Status