app/resto/core/RestoCollections.php

Summary

Maintainability
D
1 day
Test Coverage

Function filterSummaries has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    private function filterSummaries($summaries, $types)
    {
        $filteredSummaries = array();
        
        foreach (array_values($summaries) as $summary) {
Severity: Minor
Found in app/resto/core/RestoCollections.php - About 1 day 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 toArray has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function toArray()
    {
        $collections = array(
            'stac_version' => STAC::STAC_VERSION,
            'id' => $this->context->osDescription['ShortName'],
Severity: Major
Found in app/resto/core/RestoCollections.php - About 2 hrs to fix

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

        private function filterSummaries($summaries, $types)
        {
            $filteredSummaries = array();
            
            foreach (array_values($summaries) as $summary) {
    Severity: Minor
    Found in app/resto/core/RestoCollections.php - About 1 hr to fix

      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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function load($params = array())
          {
             
              if ( !$this->isLoaded ) {
                  
      Severity: Minor
      Found in app/resto/core/RestoCollections.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