jidaikobo-shibata/a11yc

View on GitHub
classes/Model/DataFetch.php

Summary

Maintainability
B
5 hrs
Test Coverage

Function fetchAll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fetchAll($force = false, $version = null, $group_id = null)
    {
        if ( ! is_null(static::$vals) && ! $force) return static::$vals;
        $ret = static::fetchRaw($version, $group_id);

Severity: Minor
Found in classes/Model/DataFetch.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 fetchAll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function fetchAll($force = false, $version = null, $group_id = null)
    {
        if ( ! is_null(static::$vals) && ! $force) return static::$vals;
        $ret = static::fetchRaw($version, $group_id);

Severity: Minor
Found in classes/Model/DataFetch.php - About 1 hr to fix

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

        public static function fetch($key, $url = '*', $default = array(), $force = false, $version = null, $group_id = null)
        {
            $vals = self::fetchAll($force, $version, $group_id);
    
            if ($key == 'global')
    Severity: Minor
    Found in classes/Model/DataFetch.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

    Method fetchArr has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function fetchArr($key, $url = '*', $default = array(), $force = false, $version = null, $group_id = null)
    Severity: Minor
    Found in classes/Model/DataFetch.php - About 45 mins to fix

      Method fetchOne has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function fetchOne($key, $url = '*', $default = '', $force = false, $version = null, $group_id = null)
      Severity: Minor
      Found in classes/Model/DataFetch.php - About 45 mins to fix

        Method fetch has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function fetch($key, $url = '*', $default = array(), $force = false, $version = null, $group_id = null)
        Severity: Minor
        Found in classes/Model/DataFetch.php - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status