mambax7/wflinks

View on GitHub
class/ThumbsNails.php

Summary

Maintainability
D
1 day
Test Coverage

Method resizeImage has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function resizeImage()
    {
        /** @var Wflinks\Helper $helper */
        $helper = Wflinks\Helper::getInstance();

Severity: Major
Found in class/ThumbsNails.php - About 3 hrs to fix

    Function resizeImage has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resizeImage()
        {
            /** @var Wflinks\Helper $helper */
            $helper = Wflinks\Helper::getInstance();
    
    
    Severity: Minor
    Found in class/ThumbsNails.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

    Method createThumb has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createThumb(
            $img_width = null,
            $img_height = null,
            $img_quality = null,
            $img_update = null,
    Severity: Minor
    Found in class/ThumbsNails.php - About 1 hr to fix

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

          public function createThumb(
              $img_width = null,
              $img_height = null,
              $img_quality = null,
              $img_update = null,
      Severity: Minor
      Found in class/ThumbsNails.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($img_name = null, $img_path = null, $img_savepath = null)
          {
              if (!\preg_match("/\.(jpg|gif|png|jpeg)$/i", $img_name)) {
                  //            return false;
              }
      Severity: Minor
      Found in class/ThumbsNails.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 createThumb has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $img_width = null,
              $img_height = null,
              $img_quality = null,
              $img_update = null,
              $img_aspect = null
      Severity: Minor
      Found in class/ThumbsNails.php - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

                    return DEFAULT_PATH;
        Severity: Major
        Found in class/ThumbsNails.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return false;
          Severity: Major
          Found in class/ThumbsNails.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return false;
            Severity: Major
            Found in class/ThumbsNails.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $this->_source_url . "/{$this->_img_savepath}/{$savefile}";
              Severity: Major
              Found in class/ThumbsNails.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $image;
                Severity: Major
                Found in class/ThumbsNails.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return "{$this->_img_savepath}/{$savefile}";
                  Severity: Major
                  Found in class/ThumbsNails.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status