qcubed/framework

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

Summary

Maintainability
F
1 wk
Test Coverage

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

        public function RenderImage($strPath = null) {
            if (!$this->strImagePath)
                throw new QCallerException('No Image Path was set');

            // Flow Through if No Size Information
Severity: Minor
Found in includes/base_controls/QImageControlBase.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

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

<?php
    /**
     * This file contains the QImageControlBase class.
     *
     * @package Controls
Severity: Major
Found in includes/base_controls/QImageControlBase.class.php - About 1 day to fix

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

            public function RenderImage($strPath = null) {
                if (!$this->strImagePath)
                    throw new QCallerException('No Image Path was set');
    
                // Flow Through if No Size Information
    Severity: Major
    Found in includes/base_controls/QImageControlBase.class.php - About 6 hrs to fix

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

              public function __set($strName, $mixValue) {
                  $this->blnModified = true;
      
                  switch ($strName) {
                      // APPEARANCE
      Severity: Minor
      Found in includes/base_controls/QImageControlBase.class.php - About 5 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method __set has 125 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/QImageControlBase.class.php - About 5 hrs to fix

        Function FlowThrough has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

                protected function FlowThrough($strPath) {
                    // No Image Type changing
                    if ((!$this->strImageType) || ($this->strImageType == $this->strSourceImageType)) {
                        if ($strPath)
                            copy($this->strImagePath, $strPath);
        Severity: Minor
        Found in includes/base_controls/QImageControlBase.class.php - About 3 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

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

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

        Function RenderAsImgSrc has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

                public function RenderAsImgSrc($blnDisplayOutput = true) {
                    // If not a visible control, then don't process anything
                    if (!$this->blnVisible) return;
                    
                    // Ensure that the ImagePath is Valid
        Severity: Minor
        Found in includes/base_controls/QImageControlBase.class.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 FlowThrough has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                protected function FlowThrough($strPath) {
                    // No Image Type changing
                    if ((!$this->strImageType) || ($this->strImageType == $this->strSourceImageType)) {
                        if ($strPath)
                            copy($this->strImagePath, $strPath);
        Severity: Minor
        Found in includes/base_controls/QImageControlBase.class.php - About 1 hr to fix

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

                  protected function GetControlHtml() {
                      try {
                          // Figure Out the Path
                          $strPath = $this->RenderAsImgSrc(false);
                      } catch (QCallerException $objExc) {
          Severity: Minor
          Found in includes/base_controls/QImageControlBase.class.php - About 1 hr to fix

            Method RenderAsImgSrc has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public function RenderAsImgSrc($blnDisplayOutput = true) {
                        // If not a visible control, then don't process anything
                        if (!$this->blnVisible) return;
                        
                        // Ensure that the ImagePath is Valid
            Severity: Minor
            Found in includes/base_controls/QImageControlBase.class.php - About 1 hr to fix

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

                      protected function GetControlHtml() {
                          try {
                              // Figure Out the Path
                              $strPath = $this->RenderAsImgSrc(false);
                          } catch (QCallerException $objExc) {
              Severity: Minor
              Found in includes/base_controls/QImageControlBase.class.php - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Avoid too many return statements within this method.
              Open

                                          return;
              Severity: Major
              Found in includes/base_controls/QImageControlBase.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/QImageControlBase.class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

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

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

                                                return;
                        Severity: Major
                        Found in includes/base_controls/QImageControlBase.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/QImageControlBase.class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                        return;
                            Severity: Major
                            Found in includes/base_controls/QImageControlBase.class.php - About 30 mins to fix

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

                                      public function RenderImage($strPath = null) {
                                          if (!$this->strImagePath)
                                              throw new QCallerException('No Image Path was set');
                              
                                          // Flow Through if No Size Information

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

                                      public function RenderImage($strPath = null) {
                                          if (!$this->strImagePath)
                                              throw new QCallerException('No Image Path was set');
                              
                                          // Flow Through if No Size Information

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

                                      public function RenderAsImgSrc($blnDisplayOutput = true) {
                                          // If not a visible control, then don't process anything
                                          if (!$this->blnVisible) return;
                                          
                                          // Ensure that the ImagePath is Valid

                              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 33. 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

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

                                      protected function FlowThrough($strPath) {
                                          // No Image Type changing
                                          if ((!$this->strImageType) || ($this->strImageType == $this->strSourceImageType)) {
                                              if ($strPath)
                                                  copy($this->strImagePath, $strPath);

                              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 38. The configured cyclomatic complexity threshold is 10.
                              Open

                                      public function RenderImage($strPath = null) {
                                          if (!$this->strImagePath)
                                              throw new QCallerException('No Image Path was set');
                              
                                          // Flow Through if No Size Information

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

                                      public function __get($strName) {
                                          switch ($strName) {
                                              // APPEARANCE
                                              case "ScaleCanvasDown": return $this->blnScaleCanvasDown;
                                              case "ScaleImageUp": return $this->blnScaleImageUp;

                              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

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

                                                      throw new QCallerException('ImageType is not a known image type');

                              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 '701', 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

                              The method RenderAsImgSrc has a boolean flag argument $blnDisplayOutput, which is a certain sign of a Single Responsibility Principle violation.
                              Open

                                      public function RenderAsImgSrc($blnDisplayOutput = true) {

                              BooleanArgumentFlag

                              Since: 1.4.0

                              A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                              Example

                              class Foo {
                                  public function bar($flag = true) {
                                  }
                              }

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

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

                                                      throw new QCallerException('Original image is of an invalid file path');

                              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 '288', column '16').
                              Open

                                                  throw new Exception('Invalid Image Type');

                              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 '102', 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 '692', 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 '646', column '18').
                              Open

                                                          throw new QCallerException('ImagePath is not defined or does not exist');

                              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 '71', column '15').
                              Open

                                              throw new QCallerException('ImagePath is not defined or does not exist');

                              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 '488', column '16').
                              Open

                                                  throw new QCallerException('Invalid Source Image Type');

                              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 '525', column '16').
                              Open

                                                  throw new QCallerException('Invalid Image Type');

                              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 '294', column '15').
                              Open

                                              throw new QCallerException('No Image Path was set');

                              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 '663', column '19').
                              Open

                                                              throw new QCallerException('Image Type cannot be determined: ' . $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

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

                                              $strAlt = ' alt="' . QApplication::HtmlEntities($this->strAlternateText) . '"';

                              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::QueryString('q');

                              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->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 assigning values to variables in if clauses and the like (line '502', column '10').
                              Open

                                      public function RenderImage($strPath = null) {
                                          if (!$this->strImagePath)
                                              throw new QCallerException('No Image Path was set');
                              
                                          // Flow Through if No Size Information

                              IfStatementAssignment

                              Since: 2.7.0

                              Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                              Example

                              class Foo
                              {
                                  public function bar($flag)
                                  {
                                      if ($foo = 'bar') { // possible typo
                                          // ...
                                      }
                                      if ($baz = 0) { // always false
                                          // ...
                                      }
                                  }
                              }

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

                              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

                              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 {
                                                      $intDestinationWidth = $this->strWidth;
                                                      $intDestinationHeight = $this->strHeight;
                                                      $intCanvasWidth = $intDestinationWidth;
                                                      $intCanvasHeight = $intDestinationHeight;

                              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->blnScaleCanvasDown = 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->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

                                                      $this->strAlternateText = 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 {
                                                      $intCanvasWidth = $this->strWidth;
                                                      $intCanvasHeight = $this->strHeight;
                                                  }

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

                                          } else {
                                              // Setup Style and Other Attribute Information (EXCEPT for "BackColor", "Width" and "Height")
                                              $strBackColor = $this->strBackColor;
                                              $strWidth = $this->strWidth;
                                              $strHeight = $this->strHeight;

                              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

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

                                          } else {
                                              switch ($this->strSourceImageType) {
                                                  case QImageType::Jpeg:
                                                      $objImage = imagecreatefromjpeg($this->strImagePath);
                                                      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

                              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 {
                                                      $intDestinationWidth = $intSourceWidth * $this->strHeight / $intSourceHeight;
                                                      $intDestinationHeight = $this->strHeight;
                                                      $intCanvasWidth = $intSourceWidth * $this->strHeight / $intSourceHeight;
                                                      $intCanvasHeight = $this->strHeight;

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

                                                          QApplication::Translate(
                                                              "The filename size exceeded for the serialized QImageControl 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

                              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 {
                                                  $intDestinationWidth = $intSourceWidth * $this->strHeight / $intSourceHeight;
                                                  $intDestinationHeight = $this->strHeight;
                                                  $intCanvasWidth = $intDestinationWidth;
                                                  $intCanvasHeight = $intDestinationHeight;

                              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

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

                                              else {
                                                  $this->SetupContentType();
                                                  print file_get_contents($this->strImagePath, 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 assigning values to variables in if clauses and the like (line '278', column '10').
                              Open

                                      protected function SetupContentType() {
                                          // TODO: Update Cache Parameters
                                          QApplication::$ProcessOutput = false;
                                          header('Cache-Control: cache');
                                          header('Expires: Wed, 20 Mar 2019 05:00:00 GMT');

                              IfStatementAssignment

                              Since: 2.7.0

                              Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                              Example

                              class Foo
                              {
                                  public function bar($flag)
                                  {
                                      if ($foo = 'bar') { // possible typo
                                          // ...
                                      }
                                      if ($baz = 0) { // always false
                                          // ...
                                      }
                                  }
                              }

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

                              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 {
                                                      $intDestinationWidth = $this->strWidth;
                                                      $intDestinationHeight = $intSourceHeight * $this->strWidth / $intSourceWidth;
                                                      $intCanvasWidth = $this->strWidth;
                                                      $intCanvasHeight = $intSourceHeight * $this->strWidth / $intSourceWidth;

                              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

                              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 {
                                              // DIMENSIONS THE SAME -- Flow Through
                                              if (($this->strHeight == $intSourceHeight) && ($this->strWidth == $intSourceWidth)) {
                                                      $this->FlowThrough($strPath);
                                                      return;

                              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

                                                      $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->strCacheFilename = 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 {
                                                  $intDestinationWidth = $this->strWidth;
                                                  $intDestinationHeight = $intSourceHeight * $this->strWidth / $intSourceWidth;
                                                  $intCanvasWidth = $intDestinationWidth;
                                                  $intCanvasHeight = $intDestinationHeight;

                              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->blnScaleImageUp = 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->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

                              TODO found
                              Open

                                          // TODO: Update Cache Parameters

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

                                          if ($this->strCachedActualFilePath) {
                                              $objDimensions = getimagesize($this->strCachedActualFilePath);
                              
                                              // Setup Style and Other Attribute Information (EXCEPT for "BackColor")
                                              // Use actual "Width" and "Height" values from cached image
                              Severity: Major
                              Found in includes/base_controls/QImageControlBase.class.php and 1 other location - About 1 day to fix
                              includes/base_controls/QImageBase.class.php on lines 136..167

                              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 272.

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

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

                                      public static function Run() {
                                          $strData = QApplication::QueryString('q');
                                          $strData = str_replace('-', '+', $strData);
                                          $strData = str_replace('_', '/', $strData);
                              
                              
                              Severity: Major
                              Found in includes/base_controls/QImageControlBase.class.php and 1 other location - About 1 hr to fix
                              includes/base_controls/QImageBase.class.php on lines 214..226

                              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 118.

                              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 5 locations. Consider refactoring.
                              Open

                                      public function __get($strName) {
                                          switch ($strName) {
                                              // APPEARANCE
                                              case "ScaleCanvasDown": return $this->blnScaleCanvasDown;
                                              case "ScaleImageUp": return $this->blnScaleImageUp;
                              Severity: Major
                              Found in includes/base_controls/QImageControlBase.class.php and 4 other locations - About 1 hr to fix
                              includes/base_controls/QAccordionGen.class.php on lines 307..325
                              includes/base_controls/QDroppableGen.class.php on lines 337..355
                              includes/base_controls/QRadioButtonList.class.php on lines 305..329
                              includes/base_controls/QSelectableGen.class.php on lines 316..334

                              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 115.

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

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

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

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

                              Refactorings

                              Further Reading

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

                                          if ($this->strCacheFolder) {
                                              $strFilePath = sprintf('%s%s/%s',
                                                  __DOCROOT__,
                                                  str_replace(__VIRTUAL_DIRECTORY__, '', $this->strCacheFolder),
                                                  $strImageFilename);
                              Severity: Minor
                              Found in includes/base_controls/QImageControlBase.class.php and 1 other location - About 55 mins to fix
                              includes/base_controls/QImageBase.class.php on lines 89..111

                              Duplicated Code

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

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

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

                              Tuning

                              This issue has a mass of 99.

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

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

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

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

                              Refactorings

                              Further Reading

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

                                          switch ($this->strSourceImageType) {
                                              case QImageType::Jpeg:
                                                  $objImage = imagecreatefromjpeg($this->strImagePath);
                                                  break;
                                              case QImageType::Png:
                              Severity: Minor
                              Found in includes/base_controls/QImageControlBase.class.php and 1 other location - About 30 mins to fix
                              includes/base_controls/QImageControlBase.class.php on lines 226..238

                              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 90.

                              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 2 locations. Consider refactoring.
                              Open

                                              switch ($this->strSourceImageType) {
                                                  case QImageType::Jpeg:
                                                      $objImage = imagecreatefromjpeg($this->strImagePath);
                                                      break;
                                                  case QImageType::Png:
                              Severity: Minor
                              Found in includes/base_controls/QImageControlBase.class.php and 1 other location - About 30 mins to fix
                              includes/base_controls/QImageControlBase.class.php on lines 477..489

                              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 90.

                              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 $strCachedActualFilePath. Keep variable name length under 20.
                              Open

                                      protected $strCachedActualFilePath = 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->strControlId = 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 SetupContentType is not named in camelCase.
                              Open

                                      protected function SetupContentType() {
                                          // TODO: Update Cache Parameters
                                          QApplication::$ProcessOutput = false;
                                          header('Cache-Control: cache');
                                          header('Expires: Wed, 20 Mar 2019 05:00:00 GMT');

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

                                      protected function FlowThrough($strPath) {
                                          // No Image Type changing
                                          if ((!$this->strImageType) || ($this->strImageType == $this->strSourceImageType)) {
                                              if ($strPath)
                                                  copy($this->strImagePath, $strPath);

                              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::QueryString('q');
                                          $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 GetControlHtml is not named in camelCase.
                              Open

                                      protected function GetControlHtml() {
                                          try {
                                              // Figure Out the Path
                                              $strPath = $this->RenderAsImgSrc(false);
                                          } catch (QCallerException $objExc) {

                              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

                                      public function RenderImage($strPath = null) {
                                          if (!$this->strImagePath)
                                              throw new QCallerException('No Image Path was set');
                              
                                          // Flow Through if No Size Information

                              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

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

                                      public function RenderAsImgSrc($blnDisplayOutput = true) {
                                          // If not a visible control, then don't process anything
                                          if (!$this->blnVisible) return;
                                          
                                          // Ensure that the ImagePath is Valid

                              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