src/LastFm.php
Method doRequest
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function doRequest($method, array $parameters = [], $doRequestAuth = false)
{
// We automatically append a few parameters here.
$parameters = array_merge(
[
The method doRequest has a boolean flag argument $doRequestAuth, which is a certain sign of a Single Responsibility Principle violation. Open
Open
protected function doRequest($method, array $parameters = [], $doRequestAuth = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '109', column '23'). Open
Open
throw new \Chrismou\LastFm\Exception\ResponseErrorException("[{$response->error}|{$response->message}] "
- 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
Missing class import via use statement (line '104', column '23'). Open
Open
throw new \Chrismou\LastFm\Exception\ResponseMalformedException("Error parsing JSON");
- 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 get has a boolean flag argument $authRequired, which is a certain sign of a Single Responsibility Principle violation. Open
Open
public function get($method, array $parameters = [], $authRequired = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}