CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/FannieAPI.php

Summary

Maintainability
F
3 days
Test Coverage
C
72%

Function listModules has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    static public function listModules($base_class, $include_base=false, $debug=false)
    {
        // leading backslash is ignored
        if ($base_class[0] == '\\') {
            $base_class = substr($base_class, 1);
Severity: Minor
Found in fannie/classlib2.0/FannieAPI.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

File FannieAPI.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/classlib2.0/FannieAPI.php - About 4 hrs to fix

    Method listModules has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        static public function listModules($base_class, $include_base=false, $debug=false)
        {
            // leading backslash is ignored
            if ($base_class[0] == '\\') {
                $base_class = substr($base_class, 1);
    Severity: Major
    Found in fannie/classlib2.0/FannieAPI.php - About 2 hrs to fix

      Method searchDirectories has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static private function searchDirectories($base_class)
          {
              $directories = array();
              // prefer directories from Poser if present
              $poser = FannieConfig::config('POSER');
      Severity: Major
      Found in fannie/classlib2.0/FannieAPI.php - About 2 hrs to fix

        Function findClass has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            static private function findClass($name, $path)
            {
                if (!is_dir($path)) {
                    return false;
                } else if ($name == 'index') {
        Severity: Minor
        Found in fannie/classlib2.0/FannieAPI.php - About 2 hrs 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 loadClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            static public function loadClass($name)
            {
                $session = self::session();
                $map = isset($session->FannieClassMap) ? $session->FannieClassMap : array();
        
        
        Severity: Minor
        Found in fannie/classlib2.0/FannieAPI.php - About 2 hrs 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 searchDirectories has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            static private function searchDirectories($base_class)
            {
                $directories = array();
                // prefer directories from Poser if present
                $poser = FannieConfig::config('POSER');
        Severity: Minor
        Found in fannie/classlib2.0/FannieAPI.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 loadClass has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static public function loadClass($name)
            {
                $session = self::session();
                $map = isset($session->FannieClassMap) ? $session->FannieClassMap : array();
        
        
        Severity: Minor
        Found in fannie/classlib2.0/FannieAPI.php - About 1 hr to fix

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

              public static function pathToClass($path)
              {
                  $name = false;
                  $basedir = 'unknown';
                  $path = realpath($path);
          Severity: Minor
          Found in fannie/classlib2.0/FannieAPI.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 findClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static private function findClass($name, $path)
              {
                  if (!is_dir($path)) {
                      return false;
                  } else if ($name == 'index') {
          Severity: Minor
          Found in fannie/classlib2.0/FannieAPI.php - About 1 hr to fix

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

                static public function listFiles($path)
                {
                    if (is_file($path) && substr($path,-4)=='.php') {
                        return array($path);
                    } elseif (is_dir($path)) {
            Severity: Minor
            Found in fannie/classlib2.0/FannieAPI.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 loadFromNamespace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                static private function loadFromNamespace($class)
                {
                    $namespaces = array(
                        'COREPOS\\common\\' => dirname(__FILE__) . '/../../common/',
                        'COREPOS\\Fannie\\API\\' => dirname(__FILE__) . '/',
            Severity: Minor
            Found in fannie/classlib2.0/FannieAPI.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 $files;
            Severity: Major
            Found in fannie/classlib2.0/FannieAPI.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $ret;
              Severity: Major
              Found in fannie/classlib2.0/FannieAPI.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status