HuasoFoundries/jpgraph

View on GitHub
src/image/LinkArrow.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method Stroke has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function Stroke($aImg)
    {
        list($dx, $dy) = $this->isizespec[$this->iSize];
        $x             = $this->ix;
        $y             = $this->iy;
Severity: Minor
Found in src/image/LinkArrow.php - About 1 hr to fix

    Function Stroke has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function Stroke($aImg)
        {
            list($dx, $dy) = $this->isizespec[$this->iSize];
            $x             = $this->ix;
            $y             = $this->iy;
    Severity: Minor
    Found in src/image/LinkArrow.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($x, $y, $aDirection, $aType = ARROWT_SOLID, $aSize = ARROW_S2)
    Severity: Minor
    Found in src/image/LinkArrow.php - About 35 mins to fix

      The method Stroke() contains an exit expression.
      Open

                      die();
      Severity: Minor
      Found in src/image/LinkArrow.php by phpmd

      ExitExpression

      Since: 0.2

      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

      Example

      class Foo {
          public function bar($param)  {
              if ($param === 42) {
                  exit(23);
              }
          }
      }

      Source https://phpmd.org/rules/design.html#exitexpression

      The method Stroke() contains an exit expression.
      Open

                      die();
      Severity: Minor
      Found in src/image/LinkArrow.php by phpmd

      ExitExpression

      Since: 0.2

      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

      Example

      class Foo {
          public function bar($param)  {
              if ($param === 42) {
                  exit(23);
              }
          }
      }

      Source https://phpmd.org/rules/design.html#exitexpression

      Avoid using static access to class '\Amenadiel\JpGraph\Util\JpGraphError' in method 'Stroke'.
      Open

                      Util\JpGraphError::RaiseL(6031);
      Severity: Minor
      Found in src/image/LinkArrow.php by phpmd

      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 '\Amenadiel\JpGraph\Util\JpGraphError' in method 'Stroke'.
      Open

                      Util\JpGraphError::RaiseL(6030);
      Severity: Minor
      Found in src/image/LinkArrow.php by phpmd

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

          private $ix;
      Severity: Minor
      Found in src/image/LinkArrow.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 $y. Configured minimum length is 3.
      Open

              $y             = $this->iy;
      Severity: Minor
      Found in src/image/LinkArrow.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 $x. Configured minimum length is 3.
      Open

              $x             = $this->ix;
      Severity: Minor
      Found in src/image/LinkArrow.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 $iy. Configured minimum length is 3.
      Open

          private $iy;
      Severity: Minor
      Found in src/image/LinkArrow.php by phpmd

      ShortVariable

      Since: 0.2

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

      Example

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

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

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

              list($dx, $dy) = $this->isizespec[$this->iSize];
      Severity: Minor
      Found in src/image/LinkArrow.php by phpmd

      ShortVariable

      Since: 0.2

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

      Example

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

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

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

              list($dx, $dy) = $this->isizespec[$this->iSize];
      Severity: Minor
      Found in src/image/LinkArrow.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 $c. Configured minimum length is 3.
      Open

                      $c = [$x, $y, $x - $dx, $y - $dy, $x + $dx, $y - $dy, $x, $y];
      Severity: Minor
      Found in src/image/LinkArrow.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 $x. Configured minimum length is 3.
      Open

          public function __construct($x, $y, $aDirection, $aType = ARROWT_SOLID, $aSize = ARROW_S2)
      Severity: Minor
      Found in src/image/LinkArrow.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 $y. Configured minimum length is 3.
      Open

          public function __construct($x, $y, $aDirection, $aType = ARROWT_SOLID, $aSize = ARROW_S2)
      Severity: Minor
      Found in src/image/LinkArrow.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

      Method name "LinkArrow::Stroke" is not in camel caps format
      Open

          public function Stroke($aImg)
      Severity: Minor
      Found in src/image/LinkArrow.php by phpcodesniffer

      Method name "LinkArrow::SetSize" is not in camel caps format
      Open

          public function SetSize($aSize)
      Severity: Minor
      Found in src/image/LinkArrow.php by phpcodesniffer

      Method name "LinkArrow::SetColor" is not in camel caps format
      Open

          public function SetColor($aColor)
      Severity: Minor
      Found in src/image/LinkArrow.php by phpcodesniffer

      Method name "LinkArrow::SetType" is not in camel caps format
      Open

          public function SetType($aType)
      Severity: Minor
      Found in src/image/LinkArrow.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status