mambax7/smartfaq

View on GitHub
include/functions.image.php

Summary

Maintainability
D
2 days
Test Coverage

Function sf_createThumbnail has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    function sf_createThumbnail($source, $thumb_width)
    {
        /** @var Smartfaq\Helper $helper */
        $helper = Smartfaq\Helper::getInstance();

Severity: Minor
Found in include/functions.image.php - About 7 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

Method sf_createThumbnail has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function sf_createThumbnail($source, $thumb_width)
    {
        /** @var Smartfaq\Helper $helper */
        $helper = Smartfaq\Helper::getInstance();

Severity: Major
Found in include/functions.image.php - About 4 hrs to fix

    Function sf_attachmentImage has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        function sf_attachmentImage($source)
        {
            /** @var Smartfaq\Helper $helper */
            $helper = Smartfaq\Helper::getInstance();
    
    
    Severity: Minor
    Found in include/functions.image.php - About 3 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

    Method sf_attachmentImage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function sf_attachmentImage($source)
        {
            /** @var Smartfaq\Helper $helper */
            $helper = Smartfaq\Helper::getInstance();
    
    
    Severity: Minor
    Found in include/functions.image.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

              return false;
      Severity: Major
      Found in include/functions.image.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return true;
        Severity: Major
        Found in include/functions.image.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return true;
          Severity: Major
          Found in include/functions.image.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return true;
            Severity: Major
            Found in include/functions.image.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in include/functions.image.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                        return false;
                Severity: Major
                Found in include/functions.image.php - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status