suitmedia/suitcoda

View on GitHub
app/Supports/ResultReader.php

Summary

Maintainability
B
5 hrs
Test Coverage

File ResultReader.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Suitcoda\Supports;

use Suitcoda\Model\Issue;
Severity: Minor
Found in app/Supports/ResultReader.php - About 2 hrs to fix

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

        public function getPsiErrorDescription($urlBlocks)
        {
            $result = '';
            foreach ($urlBlocks as $block) {
                if (isset($block->header)) {
    Severity: Minor
    Found in app/Supports/ResultReader.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

    Avoid too many return statements within this method.
    Open

                    return $this->gPagespeedResultReader($match[0] . $this->job->url->id . '/resultPagespeedMobile.json');
    Severity: Major
    Found in app/Supports/ResultReader.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $this->jsResultReader($match[0] . $this->job->url->id . '/resultJS.json');
      Severity: Major
      Found in app/Supports/ResultReader.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this->socialMediaResultReader($match[0] . $this->job->url->id . '/resultSocmed.json');
        Severity: Major
        Found in app/Supports/ResultReader.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $this->ySlowResultReader($match[0] . $this->job->url->id . '/resultYSlow.json');
          Severity: Major
          Found in app/Supports/ResultReader.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $this->gPagespeedResultReader($match[0] . $this->job->url->id . '/resultPagespeedDesktop.json');
            Severity: Major
            Found in app/Supports/ResultReader.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status