chrismou/php-lastfm-wrapper

View on GitHub
src/LastFm.php

Summary

Maintainability
A
1 hr
Test Coverage

Method doRequest has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function doRequest($method, array $parameters = [], $doRequestAuth = false)
    {
        // We automatically append a few parameters here.
        $parameters = array_merge(
            [
Severity: Minor
Found in src/LastFm.php - About 1 hr to fix

    The method doRequest has a boolean flag argument $doRequestAuth, which is a certain sign of a Single Responsibility Principle violation.
    Open

        protected function doRequest($method, array $parameters = [], $doRequestAuth = false)
    Severity: Minor
    Found in src/LastFm.php by phpmd

    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

                throw new \Chrismou\LastFm\Exception\ResponseErrorException("[{$response->error}|{$response->message}] "
    Severity: Minor
    Found in src/LastFm.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

    Missing class import via use statement (line '104', column '23').
    Open

                throw new \Chrismou\LastFm\Exception\ResponseMalformedException("Error parsing JSON");
    Severity: Minor
    Found in src/LastFm.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 get has a boolean flag argument $authRequired, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function get($method, array $parameters = [], $authRequired = false)
    Severity: Minor
    Found in src/LastFm.php by phpmd

    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

    There are no issues that match your filters.

    Category
    Status