app/resto/core/addons/Tag.php

Summary

Maintainability
D
1 day
Test Coverage

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

    private function keywordsFromFacets($properties, $facetCategory, $model)
    {
        $parentId = null;
        $keywords = array();
        for ($i = 0, $ii = count($facetCategory); $i < $ii; $i++) {
Severity: Minor
Found in app/resto/core/addons/Tag.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

File Tag.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * Copyright 2018 Jérôme Gasperi
 *
 * Licensed under the Apache License, version 2.0 (the "License");
Severity: Minor
Found in app/resto/core/addons/Tag.php - About 2 hrs to fix

    Method keywordsFromFacets has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function keywordsFromFacets($properties, $facetCategory, $model)
        {
            $parentId = null;
            $keywords = array();
            for ($i = 0, $ii = count($facetCategory); $i < $ii; $i++) {
    Severity: Minor
    Found in app/resto/core/addons/Tag.php - About 1 hr to fix

      Method getGenericKeywords has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getGenericKeywords($properties, $options)
          {
              $keywords = array();
              for ($i = 0, $ii = count($properties); $i < $ii; $i++) {
                  $keyword = $this->getGenericKeyword($properties[$i], $options['defaultName'], $options['parentId']);
      Severity: Minor
      Found in app/resto/core/addons/Tag.php - About 1 hr to fix

        Function getGenericKeywords has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getGenericKeywords($properties, $options)
            {
                $keywords = array();
                for ($i = 0, $ii = count($properties); $i < $ii; $i++) {
                    $keyword = $this->getGenericKeyword($properties[$i], $options['defaultName'], $options['parentId']);
        Severity: Minor
        Found in app/resto/core/addons/Tag.php - About 1 hr 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 processITagKeywords has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function processITagKeywords($iTagFeature)
            {
                /*
                 * Initialize keywords array from faceted properties
                 */
        Severity: Minor
        Found in app/resto/core/addons/Tag.php - About 1 hr to fix

          Method keywordsFromITag has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function keywordsFromITag($properties, $geometry, $iTagParams)
              {
                  /*
                   * No geometry = no iTag
                   *
          Severity: Minor
          Found in app/resto/core/addons/Tag.php - About 1 hr to fix

            Function processITagKeywords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                private function processITagKeywords($iTagFeature)
                {
                    /*
                     * Initialize keywords array from faceted properties
                     */
            Severity: Minor
            Found in app/resto/core/addons/Tag.php - About 1 hr 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 keywordsFromITag has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function keywordsFromITag($properties, $geometry, $iTagParams)
                {
                    /*
                     * No geometry = no iTag
                     *
            Severity: Minor
            Found in app/resto/core/addons/Tag.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 getLandCoverKeywords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getLandCoverKeywords($properties)
                {
                    $keywords = array();
            
                    /*
            Severity: Minor
            Found in app/resto/core/addons/Tag.php - About 25 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

            There are no issues that match your filters.

            Category
            Status