mambax7/extgallery

View on GitHub
class/pear/Image/Transform/Driver/GD.php

Summary

Maintainability
C
1 day
Test Coverage

The class Image_Transform_Driver_GD has 17 public methods. Consider refactoring Image_Transform_Driver_GD to keep number of public methods under 10.
Open

class Image_Transform_Driver_GD extends Image_Transform
{
    /**
     * Holds the image resource for manipulation
     *

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Image_Transform_Driver_GD has an overall complexity of 70 which is very high. The configured complexity threshold is 50.
Open

class Image_Transform_Driver_GD extends Image_Transform
{
    /**
     * Holds the image resource for manipulation
     *

File GD.php has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/* vim: set expandtab tabstop=4 shiftwidth=4: */

/**
Severity: Minor
Found in class/pear/Image/Transform/Driver/GD.php - About 3 hrs to fix

    Function _createImage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _createImage($width = -1, $height = -1, $trueColor = null)
        {
            if (-1 == $width) {
                $width = $this->new_x;
            }
    Severity: Minor
    Found in class/pear/Image/Transform/Driver/GD.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 _createImage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _createImage($width = -1, $height = -1, $trueColor = null)
        {
            if (-1 == $width) {
                $width = $this->new_x;
            }
    Severity: Minor
    Found in class/pear/Image/Transform/Driver/GD.php - About 1 hr to fix

      Function __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct()
          {
              if (!PEAR::loadExtension('gd')) {
                  $this->isError(PEAR::raiseError('GD library is not available.', IMAGE_TRANSFORM_ERROR_UNSUPPORTED));
              } else {
      Severity: Minor
      Found in class/pear/Image/Transform/Driver/GD.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

      Method _generate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _generate($filename, $type = '', $quality = null)
          {
              $type    = mb_strtolower(('' == $type) ? $this->type : $type);
              $options = is_array($quality) ? $quality : [];
              switch ($type) {
      Severity: Minor
      Found in class/pear/Image/Transform/Driver/GD.php - About 1 hr to fix

        Function _generate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _generate($filename, $type = '', $quality = null)
            {
                $type    = mb_strtolower(('' == $type) ? $this->type : $type);
                $options = is_array($quality) ? $quality : [];
                switch ($type) {
        Severity: Minor
        Found in class/pear/Image/Transform/Driver/GD.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

        The method _createImage() has an NPath complexity of 432. The configured NPath complexity threshold is 200.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method _generate() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
        Open

            public function _generate($filename, $type = '', $quality = null)
            {
                $type    = mb_strtolower(('' == $type) ? $this->type : $type);
                $options = is_array($quality) ? $quality : [];
                switch ($type) {

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method _createImage() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        The method _generate() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
        Open

            public function _generate($filename, $type = '', $quality = null)
            {
                $type    = mb_strtolower(('' == $type) ? $this->type : $type);
                $options = is_array($quality) ? $quality : [];
                switch ($type) {

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        Avoid using undefined variables such as '$x' which will lead to PHP notices.
        Open

                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$text' which will lead to PHP notices.
        Open

                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$font' which will lead to PHP notices.
        Open

                if ('ttf' == mb_substr($font, -3)) {

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$size' which will lead to PHP notices.
        Open

                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$angle' which will lead to PHP notices.
        Open

                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$y' which will lead to PHP notices.
        Open

                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$font' which will lead to PHP notices.
        Open

                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$size' which will lead to PHP notices.
        Open

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$y' which will lead to PHP notices.
        Open

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$angle' which will lead to PHP notices.
        Open

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$x' which will lead to PHP notices.
        Open

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$font' which will lead to PHP notices.
        Open

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$new_x' which will lead to PHP notices.
        Open

                $new_img = $this->_createImage($new_x, $new_y, $this->true_color);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$new_y' which will lead to PHP notices.
        Open

                $new_img = $this->_createImage($new_x, $new_y, $this->true_color);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$text' which will lead to PHP notices.
        Open

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Remove error control operator '@' on line 591.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        ErrorControlOperator

        Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

        Example

        function foo($filePath) {
            $file = @fopen($filPath); // hides exceptions
            $key = @$array[$notExistingKey]; // assigns null to $key
        }

        Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

        The method addBorder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        imagecolorset($new_img, imagecolorat($new_img, 0, 0), $color[0], $color[1], $color[2]);
                    }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class 'PEAR' in method 'crop'.
        Open

                    return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class 'PEAR' in method 'load'.
        Open

                    return PEAR::raiseError('Error while loading image file.', IMAGE_TRANSFORM_ERROR_IO);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class 'PEAR' in method 'load'.
        Open

                if (PEAR::isError($result)) {

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class 'PEAR' in method '__construct'.
        Open

                if (!PEAR::loadExtension('gd')) {

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        The method _createImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $createtruecolor = true;
                    }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class 'PEAR' in method '__construct'.
        Open

                        $this->isError(PEAR::raiseError('No supported image types available', IMAGE_TRANSFORM_ERROR_UNSUPPORTED));

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class 'PEAR' in method '_generate'.
        Open

                    return PEAR::raiseError('Couldn\'t ' . $action, IMAGE_TRANSFORM_ERROR_IO);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        The method _generate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $action = 'save image to file';
                }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class 'PEAR' in method 'crop'.
        Open

                    return PEAR::raiseError('Failed transformation: crop()', IMAGE_TRANSFORM_ERROR_FAILED);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class 'PEAR' in method '_generate'.
        Open

                    return PEAR::raiseError('Image type not supported for output', IMAGE_TRANSFORM_ERROR_UNSUPPORTED);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        The method _generate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                        } else {
                            $result = $functionName($this->imageHandle, $filename);
                        }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class 'PEAR' in method '__construct'.
        Open

                    $this->isError(PEAR::raiseError('GD library is not available.', IMAGE_TRANSFORM_ERROR_UNSUPPORTED));

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        Avoid using static access to class 'PEAR' in method '_resize'.
        Open

                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $types = imagetypes();
                    if ($types & IMG_PNG) {
                        $this->_supported_image_types['png'] = 'rw';
                    }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class 'PEAR' in method 'load'.
        Open

                    return PEAR::raiseError('Image type not supported for input', IMAGE_TRANSFORM_ERROR_UNSUPPORTED);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        The method addText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    imagepstext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);
                }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid using static access to class 'PEAR' in method 'save'.
        Open

                    return PEAR::raiseError('Filename missing', IMAGE_TRANSFORM_ERROR_ARGUMENT);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

        Source https://phpmd.org/rules/cleancode.html#staticaccess

        The method _createImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $createtruecolor = $trueColor;
                }

        ElseExpression

        Since: 1.4.0

        An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($flag) {
                    // one branch
                } else {
                    // another branch
                }
            }
        }

        Source https://phpmd.org/rules/cleancode.html#elseexpression

        Avoid unused local variables such as '$new_y'.
        Open

                $new_img = $this->_createImage($new_x, $new_y, $this->true_color);

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

        Avoid unused local variables such as '$new_x'.
        Open

                $new_img = $this->_createImage($new_x, $new_y, $this->true_color);

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

        Each class must be in a namespace of at least one level (a top-level vendor name)
        Open

        class Image_Transform_Driver_GD extends Image_Transform

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

            public function crop($width, $height, $x = 0, $y = 0)

        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

        The class Image_Transform_Driver_GD is not named in CamelCase.
        Open

        class Image_Transform_Driver_GD extends Image_Transform
        {
            /**
             * Holds the image resource for manipulation
             *

        CamelCaseClassName

        Since: 0.2

        It is considered best practice to use the CamelCase notation to name classes.

        Example

        class class_name {
        }

        Source

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

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        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 $c. Configured minimum length is 3.
        Open

                        $c = imagecolorresolve($this->imageHandle, $color[0], $color[1], $color[2]);

        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 $y. Configured minimum length is 3.
        Open

            public function crop($width, $height, $x = 0, $y = 0)

        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

        The parameter $new_x is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

        The parameter $new_y is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

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

                    imagettftext($this->imageHandle, $size, $angle, $x, $y, $c, $font, $text);

        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

        The parameter $border_width is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseParameterName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name parameters.

        Example

        class ClassName {
            public function doSomething($user_name) {
            }
        }

        Source

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

                $c = imagecolorresolve($this->imageHandle, $color[0], $color[1], $color[2]);

        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

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 65 and the first side effect is on line 29.
        Open

        <?php

        Method name "_resize" should not be prefixed with an underscore to indicate visibility
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)

        Method name "_createImage" should not be prefixed with an underscore to indicate visibility
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)

        Method name "Image_Transform_Driver_GD::Image_Transform_Driver_GD" is not in camel caps format
        Open

            public function Image_Transform_Driver_GD()

        Method name "_generate" should not be prefixed with an underscore to indicate visibility
        Open

            public function _generate($filename, $type = '', $quality = null)

        Line exceeds 120 characters; contains 128 characters
        Open

                    $icr_res = imagecopyresampled($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y);

        Line exceeds 120 characters; contains 178 characters
        Open

                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);

        Line exceeds 120 characters; contains 122 characters
        Open

                        $this->isError(PEAR::raiseError('No supported image types available', IMAGE_TRANSFORM_ERROR_UNSUPPORTED));

        Line exceeds 120 characters; contains 146 characters
        Open

                    $transparencyIndex = imagecolorallocate($new_img, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']);

        Class name "Image_Transform_Driver_GD" is not in camel caps format
        Open

        class Image_Transform_Driver_GD extends Image_Transform

        The variable $new_img is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_x is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $border_width is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $icr_res is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_y is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $color_mask is not named in camelCase.
        Open

            public function rotate($angle, $options = null)
            {
                if (0 == ($angle % 360)) {
                    return true;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_y is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_x is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $icr_res is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $border_width is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $color_mask is not named in camelCase.
        Open

            public function rotate($angle, $options = null)
            {
                if (0 == ($angle % 360)) {
                    return true;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $icr_res is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function crop($width, $height, $x = 0, $y = 0)
            {
                // Sanity check
                if (!$this->intersects($width, $height, $x, $y)) {
                    return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function flip()
            {
                $new_img = $this->_createImage();
                for ($y = 0; $y < $this->new_y; ++$y) {
                    imagecopy($new_img, $this->imageHandle, 0, $y, 0, $this->new_y - $y - 1, $this->new_x, 1);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $border_width is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_x is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_y is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_y is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_x is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function mirror()
            {
                $new_img = $this->_createImage();
                for ($x = 0; $x < $this->new_x; ++$x) {
                    imagecopy($new_img, $this->imageHandle, $x, 0, $this->new_x - $x - 1, 0, 1, $this->new_y);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function crop($width, $height, $x = 0, $y = 0)
            {
                // Sanity check
                if (!$this->intersects($width, $height, $x, $y)) {
                    return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $border_width is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_x is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function mirror()
            {
                $new_img = $this->_createImage();
                for ($x = 0; $x < $this->new_x; ++$x) {
                    imagecopy($new_img, $this->imageHandle, $x, 0, $this->new_x - $x - 1, 0, 1, $this->new_y);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function flip()
            {
                $new_img = $this->_createImage();
                for ($y = 0; $y < $this->new_y; ++$y) {
                    imagecopy($new_img, $this->imageHandle, 0, $y, 0, $this->new_y - $y - 1, $this->new_x, 1);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_y is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_y is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function addBorder($border_width = null, $color = '')
            {
                $this->new_x = $this->img_x + 2 * $border_width;
                $this->new_y = $this->img_y + 2 * $border_width;
        
        

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $color_mask is not named in camelCase.
        Open

            public function rotate($angle, $options = null)
            {
                if (0 == ($angle % 360)) {
                    return true;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function flip()
            {
                $new_img = $this->_createImage();
                for ($y = 0; $y < $this->new_y; ++$y) {
                    imagecopy($new_img, $this->imageHandle, 0, $y, 0, $this->new_y - $y - 1, $this->new_x, 1);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function mirror()
            {
                $new_img = $this->_createImage();
                for ($x = 0; $x < $this->new_x; ++$x) {
                    imagecopy($new_img, $this->imageHandle, $x, 0, $this->new_x - $x - 1, 0, 1, $this->new_y);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $color_mask is not named in camelCase.
        Open

            public function rotate($angle, $options = null)
            {
                if (0 == ($angle % 360)) {
                    return true;
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function crop($width, $height, $x = 0, $y = 0)
            {
                // Sanity check
                if (!$this->intersects($width, $height, $x, $y)) {
                    return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_img is not named in camelCase.
        Open

            public function crop($width, $height, $x = 0, $y = 0)
            {
                // Sanity check
                if (!$this->intersects($width, $height, $x, $y)) {
                    return PEAR::raiseError('Nothing to crop', IMAGE_TRANSFORM_ERROR_OUTOFBOUND);

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The variable $new_x is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseVariableName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name variables.

        Example

        class ClassName {
            public function doSomething() {
                $data_module = new DataModule();
            }
        }

        Source

        The method _generate is not named in camelCase.
        Open

            public function _generate($filename, $type = '', $quality = null)
            {
                $type    = mb_strtolower(('' == $type) ? $this->type : $type);
                $options = is_array($quality) ? $quality : [];
                switch ($type) {

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method _resize is not named in camelCase.
        Open

            public function _resize($new_x = null, $new_y = null, $options = null)
            {
                if (true === $this->resized) {
                    return PEAR::raiseError('You have already resized the image without saving it.  Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
                }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method Image_Transform_Driver_GD is not named in camelCase.
        Open

            public function Image_Transform_Driver_GD()
            {
                $this->__construct();
            }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method _createImage is not named in camelCase.
        Open

            public function _createImage($width = -1, $height = -1, $trueColor = null)
            {
                if (-1 == $width) {
                    $width = $this->new_x;
                }

        CamelCaseMethodName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name methods.

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        There are no issues that match your filters.

        Category
        Status