Showing 43 of 43 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function create($content)
    {
        try {
            list($gd, $mime) = $this->gdCreateFromBlob($content);
        } catch (\Exception $e) {
Severity: Minor
Found in Driver/Gd/Source.php and 1 other location - About 55 mins to fix
Driver/Gd/Source.php on lines 33..45

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 99.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    public function getBlob($format = null, array $options = [])
    {
        if (null === $format) {
            $format = isset($options['format']) ? $options['format'] : $this->getFormat();
        }
Severity: Minor
Found in Driver/Imagick/Image.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 applyHue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function applyHue($gd, $width, $height, $angle, $saturation, $brightness)
    {
        $noHue = 0 === $angle % 360;

        if ($noHue && 1.0 === $saturation) {
Severity: Minor
Found in Filter/Gd/Modulate.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 applyHue has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function applyHue($gd, $width, $height, $angle, $saturation, $brightness)
Severity: Minor
Found in Filter/Gd/Modulate.php - About 45 mins to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        protected function setFrame($index, Gmagick $image)
        {
            $this->frames[$index] = new Image($image, $this->image->getPalette(), $this->image->getMetaData());
    
            $gravity = $this->image->getGravity();
    Severity: Minor
    Found in Driver/Gmagick/Frames.php and 1 other location - About 40 mins to fix
    Driver/Imagick/Frames.php on lines 142..151

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 93.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        protected function setFrame($index, Imagick $image)
        {
            $this->frames[$index] = new Image($image, $this->image->getPalette(), $this->image->getMetaData());
    
            $gravity = $this->image->getGravity();
    Severity: Minor
    Found in Driver/Imagick/Frames.php and 1 other location - About 40 mins to fix
    Driver/Gmagick/Frames.php on lines 162..171

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 93.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function readExifData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function readExifData($url)
        {
            if (false === ($exif = @exif_read_data($url, "FILE", true, false))) {
                return [];
            }
    Severity: Minor
    Found in Info/ExifReader.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

    Function hslToRgb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function hslToRgb($h, $s, $l)
        {
            //$h /= 100;
            if (0 === $s) {
                $r = $g = $b = (int)round($l * 255);
    Severity: Minor
    Found in Filter/HslHelperTrait.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

    Function getBlob has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getBlob($imageFormat = null, array $options = [])
        {
            if (null === $format) {
                $format = isset($options['format']) ? $options['format'] : $this->getFormat();
            }
    Severity: Minor
    Found in Driver/Gmagick/Image.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

    Function hslToRgb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function hslToRgb($h, $s, $l)
        {
            //$h /= 100;
            if (0 === $s) {
                $r = $g = $b = (int)round($l * 255);
    Severity: Minor
    Found in Filter/AbstractHue.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 ImageInterface::FORMAT_WEBP;
    Severity: Major
    Found in Driver/Gd/Source.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return (float)$val;//is_string($val) && 0 !== substr_count($val, '.') ? (float)$val : (int)$val;
      Severity: Major
      Found in Color/Parser.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return array_combine(Rgb::keys(), $colors);
        Severity: Major
        Found in Color/Parser.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return 'imagexbm';
          Severity: Major
          Found in Driver/Gd/Image.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return 'imagewebp';
            Severity: Major
            Found in Driver/Gd/Image.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return array_combine(Cmyk::keys(), $cmyk);
              Severity: Major
              Found in Color/Parser.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return 'imagecreatefromwebp';
                Severity: Major
                Found in Driver/Gd/Source.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return is_numeric($ret) ? (float)$ret : $ret;
                  Severity: Major
                  Found in Color/Parser.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return false;
                    Severity: Major
                    Found in Driver/Gd/Image.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return null;
                      Severity: Major
                      Found in Driver/Gd/Source.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language