seregazhuk/php-favro-api

View on GitHub

Showing 11 of 11 total issues

Avoid variables with short names like $id. Configured minimum length is 3.
Open

    public function getById($id)
Severity: Minor
Found in src/Api/Endpoints/Organizations.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $id. Configured minimum length is 3.
Open

    public function getById($id)
Severity: Minor
Found in src/Api/Endpoints/Endpoint.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

The class Favro has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Open

class Favro
{
    /**
     * @param string $login
     * @param string $password
Severity: Minor
Found in src/Favro.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

There must be one blank line after the namespace declaration
Open

namespace seregazhuk\Favro\Api\Endpoints;

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

    public function delete($itemId, $everywhere = false)
Severity: Minor
Found in src/Api/Endpoints/CrudEndpoint.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

Avoid assigning values to variables in if clauses and the like (line '79', column '13').
Open

    public function useOrganization($organizationName)
    {
        if ($organization = $this->getOrganizationByName($organizationName)) {
            $this->organizationId = $organization['organizationId'];
        }
Severity: Minor
Found in src/Api/Api.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

Only one argument is allowed per line in a multi-line function call
Open

                $uri, [
Severity: Minor
Found in src/GuzzleHttpClient.php by phpcodesniffer

Only one argument is allowed per line in a multi-line function call
Open

                $uri, [
Severity: Minor
Found in src/GuzzleHttpClient.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}
Severity
Category
Status
Source
Language