squirrly/squirrly-seo

View on GitHub
models/SQ_PostsList.php

Summary

Maintainability
D
1 day
Test Coverage

File SQ_PostsList.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class Model_SQ_PostsList {

    /** @var integer */
Severity: Minor
Found in models/SQ_PostsList.php - About 4 hrs to fix

    Function packBriefProgress has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        private function packBriefProgress($history) {
            if (!is_array($history) || count($history) == 0)
                return false;
    
    
    Severity: Minor
    Found in models/SQ_PostsList.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 packBrief has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function packBrief($response) {
            if (!isset($response->seo))
                return;
    
            if (isset($response->seo) && ($response->seo->optimized == '0%')) {
    Severity: Minor
    Found in models/SQ_PostsList.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 packBrief has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function packBrief($response) {
            if (!isset($response->seo))
                return;
    
            if (isset($response->seo) && ($response->seo->optimized == '0%')) {
    Severity: Minor
    Found in models/SQ_PostsList.php - About 1 hr to fix

      Method getTrafficZone has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getTrafficZone() {
      
              $traffic = $this->packTraffic($this->interval);
      
              $str = '';
      Severity: Minor
      Found in models/SQ_PostsList.php - About 1 hr to fix

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

            public function getOthersSERPZone($serp) {
                $str = '';
        
                if (!is_array($serp))
                    return $str;
        Severity: Minor
        Found in models/SQ_PostsList.php - About 1 hr to fix

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

              private function getGraph($div) {
                  $traffic = SQ_ObjController::getController('SQ_Traffic', false)->getHistory($this->post_id, $this->interval, 'ASC');
                  $rows = array();
                  $table = array();
                  $table['cols'] = array(
          Severity: Minor
          Found in models/SQ_PostsList.php - About 1 hr to fix

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

                public function getSERPZone($serp) {
                    $str = '';
                    $str .= '<ul class="sq_rank_ul_values">
                            <li class="sq_rank_values">
                                <table>
            Severity: Minor
            Found in models/SQ_PostsList.php - About 1 hr to fix

              There are no issues that match your filters.

              Category
              Status