skqr/hateoas

View on GitHub
JsonApi/EntityResource.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            throw new \LogicException(self::ERROR_INACCESSIBLE_MEMBER);
Severity: Minor
Found in JsonApi/EntityResource.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 '157', column '23').
Open

            throw new \Exception(sprintf(
Severity: Minor
Found in JsonApi/EntityResource.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 '176', column '23').
Open

            throw new \Exception(sprintf(
Severity: Minor
Found in JsonApi/EntityResource.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 '139', column '19').
Open

        throw new \Exception(sprintf(self::ERROR_UNCALLABLE_GETTER, $getter));
Severity: Minor
Found in JsonApi/EntityResource.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 '184', column '23').
Open

            throw new \Exception(sprintf(
Severity: Minor
Found in JsonApi/EntityResource.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

Avoid using static access to class '\GoIntegro\Hateoas\Util\Inflector' in method 'callGetter'.
Open

        $camelized = Inflector::camelize($field, TRUE);
Severity: Minor
Found in JsonApi/EntityResource.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 excessively long variable names like $relationshipBlacklist. Keep variable name length under 20.
Open

    public static $relationshipBlacklist = [];
Severity: Minor
Found in JsonApi/EntityResource.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

Avoid excessively long variable names like $linkOnlyRelationships. Keep variable name length under 20.
Open

    public static $linkOnlyRelationships = [];
Severity: Minor
Found in JsonApi/EntityResource.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

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

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

    public $id;
Severity: Minor
Found in JsonApi/EntityResource.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

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

            ? NULL
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

        $camelized = Inflector::camelize($field, TRUE);
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

    public static function getStringId(ResourceEntityInterface $entity = NULL)
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

    {
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

                self::ERROR_NOT_RESOURCE_ENTITY, $relationship, $type
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

                self::ERROR_NOT_RESOURCE_ENTITY, $relationship, $type
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

                self::ERROR_TO_MANY_RELATION_NULL, $relationship
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

                self::ERROR_NOT_ENTITY_COLLECTION, $relationship, $type
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

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

                self::ERROR_NOT_ENTITY_COLLECTION, $relationship, $type
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

Line exceeds 120 characters; contains 217 characters
Open

        ERROR_TO_MANY_RELATION_NULL = "The to-many relationship \"%s\" returns neither an array nor a collection. The corresponding property needs to be initialized with either during the construction of the entity.",
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

        ERROR_INACCESSIBLE_MEMBER = "For some reason the field is known or is a relationship, but its value can't be accessed.",
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

Line exceeds 120 characters; contains 173 characters
Open

    const ERROR_NOT_RESOURCE_ENTITY = "The relationship \"%s\" contains a \"%s\", an entity implementing GoIntegro\\Hateoas\\JsonApi\\ResourceEntityInterface was expected.",
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

Line exceeds 120 characters; contains 180 characters
Open

        ERROR_NOT_ENTITY_COLLECTION = "The relationship \"%s\" contains a \"%s\", a collection of entities that implements Doctrine\\Common\\Collections\\Collection was expected.",
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

Expected 0 spaces after opening bracket; newline found
Open

        } elseif (
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

Expected 0 spaces after opening bracket; newline found
Open

        if (
Severity: Minor
Found in JsonApi/EntityResource.php by phpcodesniffer

There are no issues that match your filters.

Category
Status