squirrly/squirrly-seo

View on GitHub
classes/SQ_Tools.php

Summary

Maintainability
D
3 days
Test Coverage

File SQ_Tools.php has 386 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Handles the parameters and url
 *
Severity: Minor
Found in classes/SQ_Tools.php - About 5 hrs to fix

    SQ_Tools has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SQ_Tools extends SQ_FrontController {
    
        /** @var array Saved options in database */
        public static $options = array();
    
    Severity: Minor
    Found in classes/SQ_Tools.php - About 3 hrs to fix

      Method getBrowserInfo has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getBrowserInfo() {
              $u_agent = $_SERVER['HTTP_USER_AGENT'];
              $bname = 'Unknown';
              $platform = 'Unknown';
              $version = "";
      Severity: Minor
      Found in classes/SQ_Tools.php - About 1 hr to fix

        Function getBrowserInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getBrowserInfo() {
                $u_agent = $_SERVER['HTTP_USER_AGENT'];
                $bname = 'Unknown';
                $platform = 'Unknown';
                $version = "";
        Severity: Minor
        Found in classes/SQ_Tools.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 dump has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function dump() {
                $output = '';
                $callee = array('file' => '', 'line' => '');
                if (function_exists('func_get_args')) {
                    $arguments = func_get_args();
        Severity: Minor
        Found in classes/SQ_Tools.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 sq_remote_get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function sq_remote_get($url, $param = array()) {
                $cookies = '';
                $post_preview = false;
                $cookies = array();
                $cookie_string = '';
        Severity: Minor
        Found in classes/SQ_Tools.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 getOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getOptions() {
                $default = array(
                    'sq_beginner_user' => 1,
                    'sq_api' => '',
                    'sq_use' => 0,
        Severity: Minor
        Found in classes/SQ_Tools.php - About 1 hr to fix

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

              private function checkWs() {
                  if (!self::$options['sq_ws'])
                      return;
          
                  //if debug is called
          Severity: Minor
          Found in classes/SQ_Tools.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 checkErrorSettings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function checkErrorSettings($count_only = false) {
          
          
                  if (function_exists('is_network_admin') && is_network_admin())
                      return;
          Severity: Minor
          Found in classes/SQ_Tools.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 dump has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function dump() {
                  $output = '';
                  $callee = array('file' => '', 'line' => '');
                  if (function_exists('func_get_args')) {
                      $arguments = func_get_args();
          Severity: Minor
          Found in classes/SQ_Tools.php - About 1 hr to fix

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

                private function checkDebug() {
                    //if debug is called
                    if (self::getIsset('sq_debug')) {
            
            
            Severity: Minor
            Found in classes/SQ_Tools.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 sq_remote_get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function sq_remote_get($url, $param = array()) {
                    $cookies = '';
                    $post_preview = false;
                    $cookies = array();
                    $cookie_string = '';
            Severity: Minor
            Found in classes/SQ_Tools.php - About 1 hr to fix

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

                  public static function getSnippet($url) {
                      if ($url == '' || !function_exists('preg_match'))
                          return;
                      $snippet = array();
                      $length = array('title' => 66,
              Severity: Minor
              Found in classes/SQ_Tools.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 getBadLinkStructure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function getBadLinkStructure() {
                      global $wp_rewrite;
                      if (function_exists('apache_get_modules')) {
                          //Check if mod_rewrite is installed in apache
                          if (!in_array('mod_rewrite', apache_get_modules()))
              Severity: Minor
              Found in classes/SQ_Tools.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

              There are no issues that match your filters.

              Category
              Status