skqr/hateoas

View on GitHub
JsonApi/Request/BodyParser.php

Summary

Maintainability
A
50 mins
Test Coverage

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        JsonCoder $jsonCoder,
        Raml\DocNavigator $docNavigator,
        ResourceLinksHydrant $hydrant,
        CreateBodyParser $creationBodyParser,
        UpdateBodyParser $mutationBodyParser,
Severity: Major
Found in JsonApi/Request/BodyParser.php - About 50 mins to fix

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

    class BodyParser
    {
        const ERROR_PRIMARY_TYPE_KEY = "The resource type key is missing from the body.",
            ERROR_MISSING_SCHEMA = "A RAML schema was expected for the current action upon the resource \"%s\".",
            ERROR_MALFORMED_SCHEMA = "The RAML schema for the current action is missing the primary type key, \"%s\".",
    Severity: Minor
    Found in JsonApi/Request/BodyParser.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

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

                $json = Util\ArrayHelper::toObject($data);
    Severity: Minor
    Found in JsonApi/Request/BodyParser.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

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

            Params $params, $schema, array &$entityData

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

            Request $request, Params $params

    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

        {

    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

            Request $request, Params $params

    There must be one USE keyword per declaration
    Open

    use GoIntegro\Hateoas\JsonApi\JsonApiSpec,

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

            $data = NULL;

    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, $schema, array &$entityData

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

            $schema = NULL;

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

                $method, '/' . $params->primaryType

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

                        $request, $params, $body

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

                        $params, Raml\RamlSpec::HTTP_PUT

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

                    self::ERROR_MALFORMED_SCHEMA, $params->primaryType

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

                        $request, $params, $body

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

                    self::ERROR_MISSING_SCHEMA, $params->primaryType

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

                        $request, $params, $body

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

                        $request, $params, $body

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

                        $params, Raml\RamlSpec::HTTP_POST

    Line exceeds 120 characters; contains 122 characters
    Open

            ERROR_UNSUPPORTED_CONTENT_TYPE = "The expected content type is \"%s\". The content type \"%s\" is not supported.";

    Expected 0 spaces after opening bracket; newline found
    Open

            } elseif (

    There are no issues that match your filters.

    Category
    Status