skqr/hateoas

View on GitHub
JsonApi/Request/ActionParser.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using undefined variables such as '$methodToAction' which will lead to PHP notices.
Open

        $action->name = JsonApiSpec::$methodToAction[$request->getMethod()];
Severity: Minor
Found in JsonApi/Request/ActionParser.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using static access to class '\GoIntegro\Hateoas\Util\ArrayHelper' in method 'isPrimaryResourceAList'.
Open

            return !Util\ArrayHelper::isAssociative(
                $data[$params->primaryType]
            );
Severity: Minor
Found in JsonApi/Request/ActionParser.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

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

    private $mm;
Severity: Minor
Found in JsonApi/Request/ActionParser.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 $mm. Configured minimum length is 3.
Open

        MetadataMinerInterface $mm
Severity: Minor
Found in JsonApi/Request/ActionParser.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

Multi-line function declarations must define one parameter per line
Open

        Request $request, Params $params, RequestAction $action)

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {

Multi-line function declarations must define one parameter per line
Open

        Params $params, RequestAction $action

The closing parenthesis of a multi-line function declaration must be on a new line
Open

        Request $request, Params $params, RequestAction $action)

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

        return FALSE;

Multi-line function declarations must define one parameter per line
Open

        Request $request, Params $params, RequestAction $action)

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {

There must be one USE keyword per declaration
Open

use GoIntegro\Hateoas\JsonApi\DocumentPagination,

Multi-line function declarations must define one parameter per line
Open

        Request $request, Params $params, RequestAction $action

Multi-line function declarations must define one parameter per line
Open

        Request $request, Params $params, RequestAction $action

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {

There must be one USE keyword per declaration
Open

use Symfony\Component\HttpFoundation\Request,

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

        return FALSE;

Multi-line function call not indented correctly; expected 12 spaces but found 16
Open

                [

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

            )

Multi-line function call not indented correctly; expected 12 spaces but found 16
Open

                $action->name,

Expected 0 spaces after opening bracket; newline found
Open

        if (

There are no issues that match your filters.

Category
Status