Showing 249 of 257 total issues

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

    private function getITagParams($collection)
    {
        // iTag is not use because model strategy is 'none' or explicitely _useItag is set to false
        if ((isset($collection->context->query['_useItag']) && filter_var($collection->context->query['_useItag'], FILTER_VALIDATE_BOOLEAN) === false) || ($collection->model->tagConfig['strategy'] === 'none')) {
            return null;
Severity: Minor
Found in app/resto/core/RestoModel.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 explodeSearchTerms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function explodeSearchTerms($obj)
    {
        $hashtags = [];
        $output = [];
        
Severity: Minor
Found in app/resto/core/RestoModel.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 updateExtent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function updateExtent($collection)
    {
        if (isset($collection->extent['temporal']['interval'][0][0]) && (! isset($this->extent['temporal']['interval'][0][0]) || $collection->extent['temporal']['interval'][0][0] < $this->extent['temporal']['interval'][0][0])) {
            $this->extent['temporal']['interval'][0][0] = $collection->extent['temporal']['interval'][0][0];
        }
Severity: Minor
Found in app/resto/core/RestoCollections.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 getChildren has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChildren($params)
    {
        $childs = array();

        // Initialize router to process each children individually
Severity: Minor
Found in app/resto/core/addons/STAC.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 addLinks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function addLinks($feature)
    {
        /*
         * General links
         */
Severity: Minor
Found in app/resto/core/xml/ATOMFeed.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 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 getUsersProfiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUsersProfiles($params)
    {
        if (isset($params['lt']) && !ctype_digit($params['lt'])) {
            return RestoLogUtil::httpError(400, 'Invalid lt - should be numeric');
        }
Severity: Minor
Found in app/resto/core/api/UsersAPI.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 getUrlTemplate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getUrlTemplate($format)
    {
        /*
         * HTML output is based on htmlSearchEndpoint
         */
Severity: Minor
Found in app/resto/core/xml/OSDD.php - About 1 hr to fix

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

        public function updateFacet($facet)
        {
            
            $values = array(
                $facet['id']
    Severity: Minor
    Found in app/resto/core/dbfunctions/FacetsFunctions.php - About 1 hr to fix

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

          public function load($collection)
          {
              /*
               * Request start time
               */
      Severity: Minor
      Found in app/resto/core/RestoFeatureCollection.php - About 1 hr to fix

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

            public function updateFeatureDescription($feature, $description)
            {
                // Get hashtags to remove from feature before update
                $hashtagsToRemove = $this->extractHashtagsFromText($feature->toArray()['properties']['description'], true);
                $hashtagsToAdd = $this->extractHashtagsFromText($description, true);
        Severity: Minor
        Found in app/resto/core/dbfunctions/FeaturesFunctions.php - About 1 hr to fix

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

              public function storeFacets($facets, $userid, $collectionId = '*')
              {
                  // Empty facets - do nothing
                  if (!isset($facets) || count($facets) === 0) {
                      return;
          Severity: Minor
          Found in app/resto/core/dbfunctions/FacetsFunctions.php - About 1 hr to fix

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

                public function updateExtent($collection, $extentArrays)
                {
                    if (! isset($extentArrays)) {
                        return false;
                    }
            Severity: Minor
            Found in app/resto/core/dbfunctions/CollectionsFunctions.php - About 1 hr to fix

              Function storeCatalogAsFacet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function storeCatalogAsFacet($catalog, $parentId, $childs)
                  {
              
                      if ( !isset($parentId) ) {
                          $parentId = $this->parentIdFromLinks($catalog['links'] ?? array());
              Severity: Minor
              Found in app/resto/core/addons/STACCatalog.php - About 55 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 parentIdFromLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function parentIdFromLinks($links)
                  {
              
                      // Retrieve parent if any
                      for ($i = 0, $ii = count($links); $i < $ii; $i++ ) {
              Severity: Minor
              Found in app/resto/core/addons/STACCatalog.php - About 55 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 removeCatalog has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function removeCatalog($params)
                  {
              
                      $facetId = $params['segments'][count($params['segments']) - 1 ];
                      $facets = (new FacetsFunctions($this->context->dbDriver))->getFacets(array('id' => $facetId));
              Severity: Minor
              Found in app/resto/core/addons/STACCatalog.php - About 55 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 loadFromJSON has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function loadFromJSON($object, $modelName = null)
                  {
                      /*
                       * Check that object is a valid array
                       */
              Severity: Minor
              Found in app/resto/core/RestoCollection.php - About 55 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 prepareFeatureArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function prepareFeatureArray($collection, $data, $params = array())
                  {
                      /*
                       * Assume input file or stream is a JSON Feature
                       */
              Severity: Minor
              Found in app/resto/core/RestoModel.php - About 55 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 geoJSONGeometryToWKT has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function geoJSONGeometryToWKT($geometry)
                  {
                      if (!isset($geometry)) {
                          return null;
                      }
              Severity: Minor
              Found in app/resto/core/utils/RestoGeometryUtil.php - About 55 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 sendActivationLink has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function sendActivationLink($params, $body)
                  {
                      if (isset($body['email'])) {
                          if (! filter_var($body['email'], FILTER_VALIDATE_EMAIL)) {
                              RestoLogUtil::httpError(400, 'Email address is invalid');
              Severity: Minor
              Found in app/resto/core/api/ServicesAPI.php - About 55 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