mambax7/extgallery

View on GitHub
class/PhpCaptcha.php

Summary

Maintainability
C
1 day
Test Coverage

GenerateCode accesses the super-global variable $_SESSION.
Open

    public function GenerateCode()
    {
        // reset code
        $this->sCode = '';

Severity: Minor
Found in class/PhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Validate accesses the super-global variable $_SESSION.
Open

    public static function Validate($sUserCode, $bCaseInsensitive = true)
    {
        if ($bCaseInsensitive) {
            $sUserCode = mb_strtoupper($sUserCode);
        }
Severity: Minor
Found in class/PhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

GenerateCode accesses the super-global variable $_SESSION.
Open

    public function GenerateCode()
    {
        // reset code
        $this->sCode = '';

Severity: Minor
Found in class/PhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Validate accesses the super-global variable $_SESSION.
Open

    public static function Validate($sUserCode, $bCaseInsensitive = true)
    {
        if ($bCaseInsensitive) {
            $sUserCode = mb_strtoupper($sUserCode);
        }
Severity: Minor
Found in class/PhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Validate accesses the super-global variable $_SESSION.
Open

    public static function Validate($sUserCode, $bCaseInsensitive = true)
    {
        if ($bCaseInsensitive) {
            $sUserCode = mb_strtoupper($sUserCode);
        }
Severity: Minor
Found in class/PhpCaptcha.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The class PhpCaptcha has 12 public methods. Consider refactoring PhpCaptcha to keep number of public methods under 10.
Open

class PhpCaptcha
{
    public $oImage;
    public $aFonts;
    public $iWidth;
Severity: Minor
Found in class/PhpCaptcha.php by phpmd

TooManyPublicMethods

Since: 0.1

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

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

Example

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

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

class PhpCaptcha
{
    public $oImage;
    public $aFonts;
    public $iWidth;
Severity: Minor
Found in class/PhpCaptcha.php by phpmd

File PhpCaptcha.php has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Extgallery;

/***************************************************************/
Severity: Minor
Found in class/PhpCaptcha.php - About 2 hrs to fix

    Function SetCharSet has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function SetCharSet($vCharSet)
        {
            // check for input type
            if (\is_array($vCharSet)) {
                $this->aCharSet = $vCharSet;
    Severity: Minor
    Found in class/PhpCaptcha.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

    PhpCaptcha has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PhpCaptcha
    {
        public $oImage;
        public $aFonts;
        public $iWidth;
    Severity: Minor
    Found in class/PhpCaptcha.php - About 2 hrs to fix

      The class PhpCaptcha has 17 fields. Consider redesigning PhpCaptcha to keep the number of fields under 15.
      Open

      class PhpCaptcha
      {
          public $oImage;
          public $aFonts;
          public $iWidth;
      Severity: Minor
      Found in class/PhpCaptcha.php by phpmd

      TooManyFields

      Since: 0.1

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

      Example

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

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

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

          public function DrawCharacters()
          {
              $iShadowColour = '';
              // loop through and write out selected number of characters
              for ($i = 0, $iMax = mb_strlen($this->sCode); $i < $iMax; ++$i) {
      Severity: Minor
      Found in class/PhpCaptcha.php - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function Create($sFilename = '')
          {
              // check for required gd functions
              if (!\function_exists('imagecreate') || !\function_exists("image$this->sFileType")
                  || ('' != $this->vBackgroundImages && !\function_exists('imagecreatetruecolor'))) {
      Severity: Minor
      Found in class/PhpCaptcha.php - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method DrawCharacters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function DrawCharacters()
          {
              $iShadowColour = '';
              // loop through and write out selected number of characters
              for ($i = 0, $iMax = mb_strlen($this->sCode); $i < $iMax; ++$i) {
      Severity: Minor
      Found in class/PhpCaptcha.php - About 1 hr to fix

        Method Create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function Create($sFilename = '')
            {
                // check for required gd functions
                if (!\function_exists('imagecreate') || !\function_exists("image$this->sFileType")
                    || ('' != $this->vBackgroundImages && !\function_exists('imagecreatetruecolor'))) {
        Severity: Minor
        Found in class/PhpCaptcha.php - About 1 hr to fix

          Function GenerateCode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function GenerateCode()
              {
                  // reset code
                  $this->sCode = '';
          
          
          Severity: Minor
          Found in class/PhpCaptcha.php - About 25 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

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

              public function Create($sFilename = '')
              {
                  // check for required gd functions
                  if (!\function_exists('imagecreate') || !\function_exists("image$this->sFileType")
                      || ('' != $this->vBackgroundImages && !\function_exists('imagecreatetruecolor'))) {
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          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 Validate has a boolean flag argument $bCaseInsensitive, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function Validate($sUserCode, $bCaseInsensitive = true)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          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

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

                      } else {
                          $oBackgroundImage = \imagecreatefromjpeg($this->vBackgroundImages);
                      }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                  } else {
                      // create new image
                      $this->oImage = \imagecreate($this->iWidth, $this->iHeight);
                  }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                              } else {
                                  $this->aCharSet[] = $sCurrentItem;
                              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                      } else {
                          // select random character and add to code string
                          $this->sCode .= \chr(\mt_rand(65, 90));
                      }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                      } else {
                          $iRandColour = \mt_rand(0, 100);
                          $iTextColour = \imagecolorallocate($this->oImage, $iRandColour, $iRandColour, $iRandColour);
          
                          if ($this->bCharShadow) {
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                  } else {
                      $this->sFileType = 'jpeg';
                  }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                  } else {
                      $_SESSION[CAPTCHA_SESSION_ID] = $this->sCode;
                  }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                  } else {
                      if ('' != $vCharSet) {
                          // split items on commas
                          $aCharSet = \explode(',', $vCharSet);
          
          
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

                      } else {
                          $iRandColour = \mt_rand(100, 250);
                          $iLineColour = \imagecolorallocate($this->oImage, $iRandColour, $iRandColour, $iRandColour);
                      }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          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 variables with short names like $iY. Configured minimum length is 3.
          Open

                      $iY          = $this->iHeight / 2 + $iCharHeight / 4;
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          ShortVariable

          Since: 0.2

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

          Example

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

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

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

                      $iX          = $this->iSpacing / 4 + $i * $this->iSpacing;
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          ShortVariable

          Since: 0.2

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

          Example

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

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

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

          <?php
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Multi-line function declarations must define one parameter per line
          Open

                  $aFonts, // array of TrueType fonts to use - specify full path
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetMinFontSize" is not in camel caps format
          Open

              public function SetMinFontSize($iMinFontSize)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::Create" is not in camel caps format
          Open

              public function Create($sFilename = '')
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetNumLines" is not in camel caps format
          Open

              public function SetNumLines($iNumLines)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::DisplayShadow" is not in camel caps format
          Open

              public function DisplayShadow($bCharShadow)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::DrawCharacters" is not in camel caps format
          Open

              public function DrawCharacters()
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::GenerateCode" is not in camel caps format
          Open

              public function GenerateCode()
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          The CASE body must start on the line following the statement
          Open

                      case 'png':
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetMaxFontSize" is not in camel caps format
          Open

              public function SetMaxFontSize($iMaxFontSize)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetNumChars" is not in camel caps format
          Open

              public function SetNumChars($iNumChars)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::CaseInsensitive" is not in camel caps format
          Open

              public function CaseInsensitive($bCaseInsensitive)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::DrawOwnerText" is not in camel caps format
          Open

              public function DrawOwnerText()
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetWidth" is not in camel caps format
          Open

              public function SetWidth($iWidth)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetBackgroundImages" is not in camel caps format
          Open

              public function SetBackgroundImages($vBackgroundImages)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
          Open

              {
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::CalculateSpacing" is not in camel caps format
          Open

              public function CalculateSpacing()
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetOwnerText" is not in camel caps format
          Open

              public function SetOwnerText($sOwnerText)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetFileType" is not in camel caps format
          Open

              public function SetFileType($sFileType)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          The DEFAULT body must start on the line following the statement
          Open

                      default:
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Multi-line function declarations must define one parameter per line
          Open

                  $iWidth = CAPTCHA_WIDTH, // width of image
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::UseColour" is not in camel caps format
          Open

              public function UseColour($bUseColour)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::DrawLines" is not in camel caps format
          Open

              public function DrawLines()
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::WriteFile" is not in camel caps format
          Open

              public function WriteFile($sFilename)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetCharSet" is not in camel caps format
          Open

              public function SetCharSet($vCharSet)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          The CASE body must start on the line following the statement
          Open

                      case 'gif':
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::Validate" is not in camel caps format
          Open

              public static function Validate($sUserCode, $bCaseInsensitive = true)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Method name "PhpCaptcha::SetHeight" is not in camel caps format
          Open

              public function SetHeight($iHeight)
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Line exceeds 120 characters; contains 166 characters
          Open

                          \imagefttext($this->oImage, $iFontSize, $iOffsetAngle, $iX + $iRandOffsetX, $iY + $iRandOffsetY, $iShadowColour, $sCurrentFont, $this->sCode[$i], []);
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Line exceeds 120 characters; contains 166 characters
          Open

                      \imageline($this->oImage, \mt_rand(0, $this->iWidth), \mt_rand(0, $this->iHeight), \mt_rand(0, $this->iWidth), \mt_rand(0, $this->iHeight), $iLineColour);
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Line exceeds 120 characters; contains 122 characters
          Open

                      \imagefttext($this->oImage, $iFontSize, $iAngle, $iX, $iY, $iTextColour, $sCurrentFont, $this->sCode[$i], []);
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Line exceeds 120 characters; contains 126 characters
          Open

                          $iLineColour = \imagecolorallocate($this->oImage, \mt_rand(100, 250), \mt_rand(100, 250), \mt_rand(100, 250));
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          Line exceeds 120 characters; contains 126 characters
          Open

                              $iShadowColour = \imagecolorallocate($this->oImage, \mt_rand(0, 100), \mt_rand(0, 100), \mt_rand(0, 100));
          Severity: Minor
          Found in class/PhpCaptcha.php by phpcodesniffer

          The method CaseInsensitive is not named in camelCase.
          Open

              public function CaseInsensitive($bCaseInsensitive)
              {
                  $this->bCaseInsensitive = $bCaseInsensitive;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function GenerateCode()
              {
                  // reset code
                  $this->sCode = '';
          
          
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetMinFontSize($iMinFontSize)
              {
                  $this->iMinFontSize = $iMinFontSize;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetWidth($iWidth)
              {
                  $this->iWidth = $iWidth;
                  if ($this->iWidth > 500) {
                      $this->iWidth = 500;
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetNumChars($iNumChars)
              {
                  $this->iNumChars = $iNumChars;
                  $this->CalculateSpacing();
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function CalculateSpacing()
              {
                  $this->iSpacing = (int)($this->iWidth / $this->iNumChars);
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetHeight($iHeight)
              {
                  $this->iHeight = $iHeight;
                  if ($this->iHeight > 200) {
                      $this->iHeight = 200;
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetCharSet($vCharSet)
              {
                  // check for input type
                  if (\is_array($vCharSet)) {
                      $this->aCharSet = $vCharSet;
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function UseColour($bUseColour)
              {
                  $this->bUseColour = $bUseColour;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function Create($sFilename = '')
              {
                  // check for required gd functions
                  if (!\function_exists('imagecreate') || !\function_exists("image$this->sFileType")
                      || ('' != $this->vBackgroundImages && !\function_exists('imagecreatetruecolor'))) {
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetBackgroundImages($vBackgroundImages)
              {
                  $this->vBackgroundImages = $vBackgroundImages;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function DrawLines()
              {
                  for ($i = 0; $i < $this->iNumLines; ++$i) {
                      // allocate colour
                      if ($this->bUseColour) {
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function WriteFile($sFilename)
              {
                  if ('' == $sFilename) {
                      // tell browser that data is jpeg
                      \header("Content-type: image/$this->sFileType");
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          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 static function Validate($sUserCode, $bCaseInsensitive = true)
              {
                  if ($bCaseInsensitive) {
                      $sUserCode = mb_strtoupper($sUserCode);
                  }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetOwnerText($sOwnerText)
              {
                  $this->sOwnerText = $sOwnerText;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetNumLines($iNumLines)
              {
                  $this->iNumLines = $iNumLines;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function DisplayShadow($bCharShadow)
              {
                  $this->bCharShadow = $bCharShadow;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetFileType($sFileType)
              {
                  // check for valid file type
                  if (\in_array($sFileType, ['gif', 'png', 'jpeg'])) {
                      $this->sFileType = $sFileType;
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function DrawOwnerText()
              {
                  // allocate owner text colour
                  $iBlack = \imagecolorallocate($this->oImage, 0, 0, 0);
                  // get height of selected font
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function DrawCharacters()
              {
                  $iShadowColour = '';
                  // loop through and write out selected number of characters
                  for ($i = 0, $iMax = mb_strlen($this->sCode); $i < $iMax; ++$i) {
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

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

              public function SetMaxFontSize($iMaxFontSize)
              {
                  $this->iMaxFontSize = $iMaxFontSize;
              }
          Severity: Minor
          Found in class/PhpCaptcha.php by phpmd

          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