src/functions.php
Method session
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function session($instance, $client_id, $client_secret, array $options)
{
$scope = null;
$grant = null;
$authorization = null;
Method request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function request(Mastodon $service, $method, $path, $options, $class = null)
Function session
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function session($instance, $client_id, $client_secret, array $options)
{
$scope = null;
$grant = null;
$authorization = null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Missing class import via use statement (line '127', column '30'). Open
Open
$cached_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
Call to method __construct
from undeclared class \GuzzleHttp\Client
(Did you mean class \Baguette\Mastodon\Client) Open
Open
$cached_client = new \GuzzleHttp\Client;
- Exclude checks
Return type of http()
is undeclared type \GuzzleHttp\ClientInterface
Open
Open
function http(\GuzzleHttp\ClientInterface $client = null)
- Exclude checks
Return type of request()
is undeclared type \Psr\Http\Message\ResponseInterface
Open
Open
function request(Mastodon $service, $method, $path, $options, $class = null)
- Exclude checks
Call to undeclared function \GuzzleHttp\json_decode()
(Did you mean \json_decode() or \json_encode()) Open
Open
return Entity\map($class, \GuzzleHttp\json_decode($response->getBody(), true));
- Exclude checks
Parameter $client
has undeclared type ?\GuzzleHttp\ClientInterface
Open
Open
function http(\GuzzleHttp\ClientInterface $client = null)
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param Scope|string|string[]':
after Scope|string|string[],
did not see an element name (will guess based on comment order) Open
Open
* @param Scope|string|string[]
- Exclude checks
Cannot access private property \Baguette\Mastodon\Mastodon->client
defined at src/Mastodon.php:29
Open
Open
$response = $service->client->requestAPI($method, $path, $options, $service->session);
- Exclude checks
Cannot access private property \Baguette\Mastodon\Mastodon->session
defined at src/Mastodon.php:31
Open
Open
$response = $service->client->requestAPI($method, $path, $options, $service->session);
- Exclude checks
Call to deprecated function \Baguette\Mastodon\credential()
defined at src/functions.php:92
Open
Open
$grant = credential($options['credential']);
- Exclude checks