qcubed/framework

View on GitHub
includes/base_controls/QImageLabelBase.class.php

Summary

Maintainability
F
6 days
Test Coverage

Function __set has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

        public function __set($strName, $mixValue) {
            $this->blnModified = true;

            switch ($strName) {
                // APPEARANCE
Severity: Minor
Found in includes/base_controls/QImageLabelBase.class.php - About 1 day 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 __set has 218 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function __set($strName, $mixValue) {
            $this->blnModified = true;

            switch ($strName) {
                // APPEARANCE
Severity: Major
Found in includes/base_controls/QImageLabelBase.class.php - About 1 day to fix

    Function RenderImage has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

            protected function RenderImage($strPath = null) {
                $strWidth = $this->Width;
    
                // Make Sure Font File Exists
                if (file_exists($this->strFontNames))
    Severity: Minor
    Found in includes/base_controls/QImageLabelBase.class.php - About 7 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

    File QImageLabelBase.class.php has 479 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
        /**
         * This file contains the QImageLabelBase class.
         *
         * @package Controls
    Severity: Minor
    Found in includes/base_controls/QImageLabelBase.class.php - About 7 hrs to fix

      Method RenderImage has 142 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              protected function RenderImage($strPath = null) {
                  $strWidth = $this->Width;
      
                  // Make Sure Font File Exists
                  if (file_exists($this->strFontNames))
      Severity: Major
      Found in includes/base_controls/QImageLabelBase.class.php - About 5 hrs to fix

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

            abstract class QImageLabelBase extends QControl {
                ///////////////////////////
                // Private Member Variables
                ///////////////////////////
        
        

        The class QImageLabelBase has 20 fields. Consider redesigning QImageLabelBase to keep the number of fields under 15.
        Open

            abstract class QImageLabelBase extends QControl {
                ///////////////////////////
                // Private Member Variables
                ///////////////////////////
        
        

        TooManyFields

        Since: 0.1

        Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

        Example

        class Person {
           protected $one;
           private $two;
           private $three;
           [... many more fields ...]
        }

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

        Method GetControlHtml has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                protected function GetControlHtml() {
                    if (!$this->strFontNames)
        //                throw new QCallerException('Must specify a FontNames value before rendering this QImageLabel');
                        return;
        
        
        Severity: Minor
        Found in includes/base_controls/QImageLabelBase.class.php - About 1 hr to fix

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

                  protected function GetControlHtml() {
                      if (!$this->strFontNames)
          //                throw new QCallerException('Must specify a FontNames value before rendering this QImageLabel');
                          return;
          
          
          Severity: Minor
          Found in includes/base_controls/QImageLabelBase.class.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid too many return statements within this method.
          Open

                          case "ImageType": return $this->strImageType;
          Severity: Major
          Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            case "Tightness": return $this->intYCoordinate;
            Severity: Major
            Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              case "Quality": return $this->intQuality;
              Severity: Major
              Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                case "SmoothFont": return $this->blnSmoothFont;
                Severity: Major
                Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  case "HorizontalAlign": return $this->strHorizontalAlign;
                  Severity: Major
                  Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    case "PaddingHeight": return $this->intYCoordinate;
                    Severity: Major
                    Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      case "Space": return $this->intYCoordinate;
                      Severity: Major
                      Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        case "CacheFolder": return $this->strCacheFolder;
                        Severity: Major
                        Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          case "PaddingWidth": return $this->intYCoordinate;
                          Severity: Major
                          Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            case "Angle": return $this->intYCoordinate;
                            Severity: Major
                            Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              case "CachedImageFilePath": return $this->strCachedImageFilePath;
                              Severity: Major
                              Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                        return parent::__get($strName);
                                Severity: Major
                                Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  case "VerticalAlign": return $this->strVerticalAlign;
                                  Severity: Major
                                  Found in includes/base_controls/QImageLabelBase.class.php - About 30 mins to fix

                                    The method RenderImage() has an NPath complexity of 38880. The configured NPath complexity threshold is 200.
                                    Open

                                            protected function RenderImage($strPath = null) {
                                                $strWidth = $this->Width;
                                    
                                                // Make Sure Font File Exists
                                                if (file_exists($this->strFontNames))

                                    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 RenderImage() has 190 lines of code. Current threshold is set to 100. Avoid really long methods.
                                    Open

                                            protected function RenderImage($strPath = null) {
                                                $strWidth = $this->Width;
                                    
                                                // Make Sure Font File Exists
                                                if (file_exists($this->strFontNames))

                                    The method __set() has 268 lines of code. Current threshold is set to 100. Avoid really long methods.
                                    Open

                                            public function __set($strName, $mixValue) {
                                                $this->blnModified = true;
                                    
                                                switch ($strName) {
                                                    // APPEARANCE

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

                                            public function __get($strName) {
                                                switch ($strName) {
                                                    // APPEARANCE
                                                    case "Text": return $this->strText;
                                                    case "XCoordinate": return $this->intXCoordinate;

                                    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 RenderImage() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10.
                                    Open

                                            protected function RenderImage($strPath = null) {
                                                $strWidth = $this->Width;
                                    
                                                // Make Sure Font File Exists
                                                if (file_exists($this->strFontNames))

                                    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 __set() has a Cyclomatic Complexity of 56. The configured cyclomatic complexity threshold is 10.
                                    Open

                                            public function __set($strName, $mixValue) {
                                                $this->blnModified = true;
                                    
                                                switch ($strName) {
                                                    // APPEARANCE

                                    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 '$attrOverrides' which will lead to PHP notices.
                                    Open

                                                return $this->RenderTag ('img', $attrOverrides, null, null, true);

                                    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 '$attrOverrides' which will lead to PHP notices.
                                    Open

                                                $attrOverrides['src'] = $strPath;

                                    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 '$attrOverrides' which will lead to PHP notices.
                                    Open

                                                $attrOverrides['alt'] = QApplication::HtmlEntities($this->strText);

                                    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

                                    Missing class import via use statement (line '641', column '18').
                                    Open

                                                                throw new QCallerException('Cannot Determine Font Type: ' . $mixValue);

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '620', column '17').
                                    Open

                                                            throw new QCallerException('Cannot find font file: ' . $mixValue);

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '189', column '16').
                                    Open

                                                        throw new QCallerException('Cannot Determine Font Type: ' . $this->strFontNames);

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '566', column '17').
                                    Open

                                                            throw new QInvalidCastException('BackColor must be a 6-digit hexadecimal value');

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '157', column '15').
                                    Open

                                                    throw new QCallerException('Cannot find font file: ' . $this->strFontNames);

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '635', column '19').
                                    Open

                                                                    throw new QCallerException('Cannot find accompanying Font Metrics file: ' .

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '544', column '17').
                                    Open

                                                            throw new QInvalidCastException('ForeColor must be a 6-digit hexadecimal value');

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '96', column '16').
                                    Open

                                                        throw new QCallerException(

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '553', column '17').
                                    Open

                                                            throw new QInvalidCastException('ForeColor must be a 6-digit hexadecimal value');

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '639', column '18').
                                    Open

                                                                throw new QCallerException('AFM is only a Font Metrics file.  You must provide a PFB file for PostScript Type 1 Typefaces: ' . $mixValue);

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Missing class import via use statement (line '575', column '17').
                                    Open

                                                            throw new QInvalidCastException('BackColor must be a 6-digit hexadecimal value');

                                    MissingImport

                                    Since: 2.7.0

                                    Importing all external classes in a file through use statements makes them clearly visible.

                                    Example

                                    function make() {
                                        return new \stdClass();
                                    }

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

                                    Avoid using static access to class 'QType' in method '__set'.
                                    Open

                                                            $this->intTightness = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intSpace = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strVerticalAlign = QType::Cast($mixValue, QType::String);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intPaddingWidth = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strFontSize = QType::Cast($mixValue, QType::Integer);

                                    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 GetControlHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                    Open

                                                } else {
                                                    if (strlen($strSerialized) > 255/* safe max filename size */) {
                                                        throw new QCallerException(
                                                            sprintf(
                                                                QApplication::Translate(

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strText = QType::Cast($mixValue, QType::String);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strImageType = QType::Cast($mixValue, QType::String);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intQuality = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $mixValue = strtolower(QType::Cast($mixValue, QType::String));

                                    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 RenderImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                    Open

                                                } else {
                                                    switch ($this->strImageType) {
                                                        case QImageType::Gif:
                                                            imagegif($objImage, $strPath);
                                                            break;

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->blnBackgroundTransparent = QType::Cast($mixValue, QType::Boolean);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intAngle = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strCacheFolder = QType::Cast($mixValue, QType::String);

                                    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 'QApplication' in method 'GetControlHtml'.
                                    Open

                                                                QApplication::Translate(
                                                                    "The filename size exceeded for the serialized QImageLabel control." .
                                                                    " The size is %s. The maximum value is 255. Try to set the CacheFolder property to solve the problem."
                                                                )

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intPaddingHeight = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $mixValue = strtolower(QType::Cast($mixValue, QType::String));

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strWidth = QType::Cast($mixValue, QType::Integer);

                                    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 RenderImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                    Open

                                                } else {
                                                    // Step 2 - Alignment
                                                    switch ($this->strVerticalAlign) {
                                                        case QVerticalAlign::Top:
                                                            if ($blnTrueType)

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intYCoordinate = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strHeight = QType::Cast($mixValue, QType::Integer);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $mixValue = QType::Cast($mixValue, QType::String);

                                    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 RenderImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                    Open

                                                } else {
                                                    // Step 2 - Alignment
                                                    switch ($this->strHorizontalAlign) {
                                                        case QHorizontalAlign::Left:
                                                            $intX = -1 * $intXCoordinate1 + 2 + $this->intPaddingWidth;

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->intXCoordinate = QType::Cast($mixValue, QType::Integer);

                                    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 'QApplication' in method 'GetControlHtml'.
                                    Open

                                                $attrOverrides['alt'] = QApplication::HtmlEntities($this->strText);

                                    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 'QApplication' in method 'Run'.
                                    Open

                                                $strData = QApplication::PathInfo(0);

                                    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 RenderImage uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                    Open

                                                } else {
                                                    // Anti Aliasing
                                                    if ($this->blnSmoothFont)
                                                        $intAntiAliasing = 16;
                                                    else

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->blnSmoothFont = QType::Cast($mixValue, QType::Boolean);

                                    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 'QType' in method '__set'.
                                    Open

                                                            $this->strHorizontalAlign = QType::Cast($mixValue, QType::String);

                                    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

                                    TODO found
                                    Open

                                                    // TODO: Update Cache Parameters

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

                                                    case "BackColor":
                                                        try {
                                                            $mixValue = strtolower(QType::Cast($mixValue, QType::String));
                                                        } catch (QInvalidCastException $objExc) {
                                                            $objExc->IncrementOffset();
                                    Severity: Major
                                    Found in includes/base_controls/QImageLabelBase.class.php and 2 other locations - About 3 hrs to fix
                                    includes/base_controls/QImageControlBase.class.php on lines 683..703
                                    includes/base_controls/QImageLabelBase.class.php on lines 535..555

                                    Duplicated Code

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

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

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

                                    Tuning

                                    This issue has a mass of 154.

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

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

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

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

                                    Refactorings

                                    Further Reading

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

                                                    case "ForeColor":
                                                        try {
                                                            $mixValue = strtolower(QType::Cast($mixValue, QType::String));
                                                        } catch (QInvalidCastException $objExc) {
                                                            $objExc->IncrementOffset();
                                    Severity: Major
                                    Found in includes/base_controls/QImageLabelBase.class.php and 2 other locations - About 3 hrs to fix
                                    includes/base_controls/QImageControlBase.class.php on lines 683..703
                                    includes/base_controls/QImageLabelBase.class.php on lines 557..577

                                    Duplicated Code

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

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

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

                                    Tuning

                                    This issue has a mass of 154.

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

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

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

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

                                    Refactorings

                                    Further Reading

                                    Avoid excessively long variable names like $blnBackgroundTransparent. Keep variable name length under 20.
                                    Open

                                            protected $blnBackgroundTransparent = false;

                                    LongVariable

                                    Since: 0.2

                                    Detects when a field, formal or local variable is declared with a long name.

                                    Example

                                    class Something {
                                        protected $reallyLongIntName = -3; // VIOLATION - Field
                                        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                            $otherReallyLongName = -5; // VIOLATION - Local
                                            for ($interestingIntIndex = 0; // VIOLATION - For
                                                 $interestingIntIndex < 10;
                                                 $interestingIntIndex++ ) {
                                            }
                                        }
                                    }

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

                                    Avoid excessively long variable names like $strCachedImageFilePath. Keep variable name length under 20.
                                    Open

                                            protected $strCachedImageFilePath = null;

                                    LongVariable

                                    Since: 0.2

                                    Detects when a field, formal or local variable is declared with a long name.

                                    Example

                                    class Something {
                                        protected $reallyLongIntName = -3; // VIOLATION - Field
                                        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                            $otherReallyLongName = -5; // VIOLATION - Local
                                            for ($interestingIntIndex = 0; // VIOLATION - For
                                                 $interestingIntIndex < 10;
                                                 $interestingIntIndex++ ) {
                                            }
                                        }
                                    }

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

                                    The method Serialize is not named in camelCase.
                                    Open

                                            public function Serialize() {
                                                $objControl = clone($this);
                                                $objControl->objForm = null;
                                                $objControl->objParentControl = null;
                                                $objControl->strCachedImageFilePath = null;

                                    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 Run is not named in camelCase.
                                    Open

                                            public static function Run() {
                                                $strData = QApplication::PathInfo(0);
                                                $strData = str_replace('-', '+', $strData);
                                                $strData = str_replace('_', '/', $strData);
                                    
                                    

                                    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 RenderImage is not named in camelCase.
                                    Open

                                            protected function RenderImage($strPath = null) {
                                                $strWidth = $this->Width;
                                    
                                                // Make Sure Font File Exists
                                                if (file_exists($this->strFontNames))

                                    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 GetControlHtml is not named in camelCase.
                                    Open

                                            protected function GetControlHtml() {
                                                if (!$this->strFontNames)
                                    //                throw new QCallerException('Must specify a FontNames value before rendering this QImageLabel');
                                                    return;
                                    
                                    

                                    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 Validate is not named in camelCase.
                                    Open

                                            public function Validate() {return true;}

                                    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 ParsePostData is not named in camelCase.
                                    Open

                                            public function ParsePostData() {}

                                    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