vakata/image

View on GitHub

Showing 10 of 42 total issues

Method thumbnail has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
    {
        if (!$width && !$height) {
            throw new ImageException('You must supply at least one dimension');
        }
Severity: Major
Found in src/driver/GD.php - About 5 hrs to fix

    Function thumbnail has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
        {
            if (!$width && !$height) {
                throw new ImageException('You must supply at least one dimension');
            }
    Severity: Minor
    Found in src/driver/GD.php - About 5 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 thumbnail has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
        {
            if (!$width && !$height) {
                throw new ImageException('You must supply at least one dimension');
            }
    Severity: Minor
    Found in src/driver/IM.php - About 5 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 thumbnail has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function thumbnail(int $width = 0, int $height = 0, array $keep = [], bool $keepEnlarge = false)
        {
            if (!$width && !$height) {
                throw new ImageException('You must supply at least one dimension');
            }
    Severity: Major
    Found in src/driver/IM.php - About 3 hrs to fix

      Image has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Image implements ImageInterface
      {
          protected $data;
          protected $drivers;
          protected $operations;
      Severity: Minor
      Found in src/Image.php - About 2 hrs to fix

        Method getImage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getImage(string $format = null) : string
            {
                if (!$format) {
                    $format = explode('/', $this->info['mime'], 2)[1];
                }
        Severity: Minor
        Found in src/driver/GD.php - About 1 hr to fix

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

              public function resize(int $width = 0, int $height = 0)
              {
                  if (!$width && !$height) {
                      throw new ImageException('You must supply at least one dimension');
                  }
          Severity: Minor
          Found in src/driver/GD.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 getImage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getImage(string $format = null) : string
              {
                  if (!$format) {
                      $format = $this->instance->getImageFormat();
                  }
          Severity: Minor
          Found in src/driver/IM.php - About 35 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 ob_get_clean();
          Severity: Major
          Found in src/driver/GD.php - About 30 mins to fix

            Function resizeLongEdge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function resizeLongEdge(int $size, bool $enlarge = true): ImageInterface
                {
                    $w = $this->width();
                    $h = $this->height();
                    if ($w > $h) {
            Severity: Minor
            Found in src/Image.php - About 25 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

            Severity
            Category
            Status
            Source
            Language