src/Client.php
Missing class import via use statement (line '70', column '42'). Open
Open
$this->api_http_client = new \GuzzleHttp\Client([
- Read upRead up
- Exclude checks
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
Open
} else {
$user_agent = sprintf('%s; %s', self::USER_AGENT, \GuzzleHttp\default_user_agent());
}
- Read upRead up
- Exclude checks
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
Open
public function requestAPI($method, $path, array $options, SessionStorage $session)
- Exclude checks
Parameter $client
has undeclared type \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
public function setAPIHttpClient(\GuzzleHttp\Client $client)
- Exclude checks
Call to method __construct
from undeclared class \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
$this->api_http_client = new \GuzzleHttp\Client([
- Exclude checks
Property \Baguette\Mastodon\Client->oauth_http_client
has undeclared type \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
private $oauth_http_client;
- Exclude checks
Return type of getAPIHttpClient()
is undeclared type \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
private function getAPIHttpClient()
- Exclude checks
Possibly zero references to use statement for classlike/namespace Mastodon
(\Baguette\Mastodon)
Open
Open
use Baguette\Mastodon;
- Exclude checks
Call to undeclared function \GuzzleHttp\default_user_agent()
Open
Open
$user_agent = sprintf('%s; %s; %s', self::USER_AGENT, $this->client_name, \GuzzleHttp\default_user_agent());
- Exclude checks
Property \Baguette\Mastodon\Client->api_http_client
has undeclared type \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
private $api_http_client;
- Exclude checks
Call to method request
from undeclared class \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
return $this->getAPIHttpClient()->request($method, $path, $request_options);
- Exclude checks
Call to undeclared function \GuzzleHttp\default_user_agent()
Open
Open
$user_agent = sprintf('%s; %s', self::USER_AGENT, \GuzzleHttp\default_user_agent());
- Exclude checks