skqr/hateoas

View on GitHub

Showing 662 of 662 total issues

Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(
        DocumentResource $documentResource,
        ResourceCache $resourceCache,
        array $include = [],
        array $sparseFields = [],
Severity: Minor
Found in JsonApi/Document.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function create()
    {
        $include = NULL;
        $fields = NULL;

Severity: Minor
Found in JsonApi/DocumentFactory.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

        DocumentResource $documentResource,
        ResourceCache $resourceCache,
        array $include = [],
        array $sparseFields = [],
        DocumentPagination $pagination = NULL,
Severity: Minor
Found in JsonApi/Document.php - About 45 mins to fix

    Function selectRelationshipEntities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function selectRelationshipEntities(
            Params $params, array $entities
        )
        {
            $selected = [];
    Severity: Minor
    Found in JsonApi/Request/ParamEntityFinder.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getSortOrder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getSortOrder($field, $relationship = NULL)
        {
            $sortedByRelationship = NULL;
    
            if (empty($relationship)) {
    Severity: Minor
    Found in JsonApi/Request/Params.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function parseCreateAction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseCreateAction($ids, array $relation)
        {
            if (is_array($ids)) {
                if (!is_array($relation)) {
                    throw new ParseException(
    Severity: Minor
    Found in JsonApi/Request/LinkBodyParser.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    class Parser
    {
        const HTTP_OPTIONS = 'OPTIONS',
            HTTP_HEAD = 'HEAD',
            HTTP_GET = 'GET',
    Severity: Minor
    Found in JsonApi/Request/Parser.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

    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

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

    class ParamEntityFinder
    {
        const ACCESS_VIEW = 'view',
            ACCESS_EDIT = 'edit',
            ACCESS_DELETE = 'delete';
    Severity: Minor
    Found in JsonApi/Request/ParamEntityFinder.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

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

    class ResourceCollectionFactory implements Factory
    {
        /**
         * @var ResourceManager
         */
    Severity: Minor
    Found in JsonApi/ResourceCollectionFactory.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

    Method update has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            Params $params,
            ResourceEntityInterface $entity,
            array $fields,
            array $relationships = [],
            array $metadata = []
    Severity: Minor
    Found in Entity/Mutator.php - About 35 mins to fix

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

              $field,
              $resource,
              $message = "",
              $code = 0,
              \Exception $previous = NULL
      Severity: Minor
      Found in JsonApi/Serializer/InvalidFieldException.php - About 35 mins to fix

        There must be one USE keyword per declaration
        Open

        use GoIntegro\Hateoas\JsonApi\ResourceEntityInterface,

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

                    : NULL;

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

            {
        Severity: Minor
        Found in Entity/AltersEntities.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 Entity/DefaultMutator.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/Document.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

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

                Exception $previous = NULL

        The implements keyword must be on the same line as the class name
        Open

            implements Paginated
        Severity
        Category
        Status
        Source
        Language