carlonicora/jsonapi

View on GitHub

Showing 12 of 12 total issues

Function importArray has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function importArray(array $data, array $included=null): void
    {
        if (array_key_exists('meta', $data)) {
            $this->meta->importArray($data['meta']);
        }
Severity: Minor
Found in src/Objects/Relationship.php - About 3 hrs 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 addIncluded has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    private function addIncluded(ResourceObject $resource, string $parentInclude='', array $includedResourceTypes=null, bool $isPrimaryData=false) : void
    {
        if (!$isPrimaryData) {
            $includedResourceFound = false;

Severity: Minor
Found in src/Document.php - About 2 hrs 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 prepare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare(): array
    {
        foreach ($this->resources as $resource) {
            $this->addIncluded($resource, '', $this->includedResourceTypes, true);
        }
Severity: Minor
Found in src/Document.php - About 2 hrs 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 importArray has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function importArray(array $data, array $included=null): void
    {
        if (array_key_exists('type', $data)){
            $this->type = $data['type'];
        } else {
Severity: Minor
Found in src/Objects/ResourceObject.php - About 2 hrs 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 importArray has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function importArray(array $data, array $included=null): void
    {
        if (array_key_exists('included', $data)){
            $included = $data['included'];
        }
Severity: Minor
Found in src/Document.php - About 2 hrs 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 importArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function importArray(array $data, array $included=null): void
    {
        if (array_key_exists('meta', $data)) {
            $this->meta->importArray($data['meta']);
        }
Severity: Minor
Found in src/Objects/Relationship.php - About 1 hr to fix

    Method prepare has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function prepare(): array
        {
            foreach ($this->resources as $resource) {
                $this->addIncluded($resource, '', $this->includedResourceTypes, true);
            }
    Severity: Minor
    Found in src/Document.php - About 1 hr to fix

      Method importArray has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function importArray(array $data, array $included=null): void
          {
              if (array_key_exists('type', $data)){
                  $this->type = $data['type'];
              } else {
      Severity: Minor
      Found in src/Objects/ResourceObject.php - About 1 hr to fix

        Method importArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function importArray(array $data, array $included=null): void
            {
                if (array_key_exists('included', $data)){
                    $included = $data['included'];
                }
        Severity: Minor
        Found in src/Document.php - About 1 hr to fix

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

                  Exception|Error|null  $e=null,
                  ?string $httpStatusCode=null,
                  ?string $detail=null,
                  ?string $id=null,
                  ?string $errorUniqueCode=null,
          Severity: Minor
          Found in src/Objects/Error.php - About 45 mins to fix

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

                public function __construct(?string $type=null, ?string $id = null, ?array $dataImport=null, array $included=null, ?Meta $resourceIdentifierMeta=null)
            Severity: Minor
            Found in src/Objects/ResourceObject.php - About 35 mins to fix

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

                  public function __construct(
                      Exception|Error|null  $e=null,
                      ?string $httpStatusCode=null,
                      ?string $detail=null,
                      ?string $id=null,
              Severity: Minor
              Found in src/Objects/Error.php - About 35 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

              Severity
              Category
              Status
              Source
              Language