elboletaire/Watimage

View on GitHub

Showing 57 of 57 total issues

Function cropMeasures has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function cropMeasures($ox, $oy = null, $dx = null, $dy = null)
    {
        if (!isset($oy, $dx, $dy, $width, $height) && is_array($ox)) {
            $values = $ox;
            $allowedKeys = [
Severity: Minor
Found in src/Normalize.php - About 55 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 variables with short names like $oy. Configured minimum length is 3.
Open

    public function calculateCropMeasures($croppedFile, $ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Image.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $ox. Configured minimum length is 3.
Open

    public static function cropMeasures($ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $dx. Configured minimum length is 3.
Open

    public function calculateCropMeasures($croppedFile, $ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Image.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $r. Configured minimum length is 3.
Open

                list($r, $g, $b, $a) = $keys;
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $ox. Configured minimum length is 3.
Open

    public function calculateCropMeasures($croppedFile, $ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Image.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $a. Configured minimum length is 3.
Open

                list($r, $g, $b, $a) = $keys;
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $dy. Configured minimum length is 3.
Open

    public function calculateCropMeasures($croppedFile, $ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Image.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $l. Configured minimum length is 3.
Open

        $l = sin(M_PI / $this->width * $x) * sin(M_PI / $this->height * $y);
Severity: Minor
Found in src/Image.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $g. Configured minimum length is 3.
Open

                list($r, $g, $b, $a) = $keys;
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $dy. Configured minimum length is 3.
Open

    public static function cropMeasures($ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $b. Configured minimum length is 3.
Open

                list($r, $g, $b, $a) = $keys;
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $dx. Configured minimum length is 3.
Open

    public static function cropMeasures($ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $oy. Configured minimum length is 3.
Open

    public static function cropMeasures($ox, $oy = null, $dx = null, $dy = null)
Severity: Minor
Found in src/Normalize.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

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

    public static function crop($x, $y = null, $width = null, $height = null)
    {
        if (!isset($y, $width, $height) && is_array($x)) {
            $values = $x;
            $allowedKeys = [
Severity: Minor
Found in src/Normalize.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 setWatermark has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function setWatermark($options = [])
    {
        try {
            if (!$this->watermark) {
                $this->watermark = new Watermark();
Severity: Minor
Found in src/Watimage.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 imagecopy has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function imagecopy($dstW, $dstH, $srcX = 0, $srcY = 0, $srcW = false, $srcH = false)
Severity: Minor
Found in src/Image.php - About 45 mins to fix

    Method calculateCropMeasures has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function calculateCropMeasures($croppedFile, $ox, $oy = null, $dx = null, $dy = null)
    Severity: Minor
    Found in src/Image.php - About 35 mins to fix

      Method vignetteEffect has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function vignetteEffect($size, $level, $x, $y, &$rgb)
      Severity: Minor
      Found in src/Image.php - About 35 mins to fix

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

            public static function cssPosition($position)
            {
                try {
                    $position = self::position($position);
                } catch (InvalidArgumentException $e) {
        Severity: Minor
        Found in src/Normalize.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

        Severity
        Category
        Status
        Source
        Language