steeffeen/FancyManiaLinks

View on GitHub
FML/Script/Features/Tooltip.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
58%

Method prepare has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function prepare(Script $script)
    {
        $hoverControlId   = Builder::escapeText($this->hoverControl->getId());
        $tooltipControlId = Builder::escapeText($this->tooltipControl->getId());

Severity: Minor
Found in FML/Script/Features/Tooltip.php - About 1 hr to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct(Control $hoverControl = null, Control $tooltipControl = null, $stayOnClick = null, $invert = null, $text = null)
    Severity: Minor
    Found in FML/Script/Features/Tooltip.php - About 35 mins to fix

      Avoid using static access to class '\FML\Script\Builder' in method 'prepare'.
      Open

              $tooltipControlId = Builder::escapeText($this->tooltipControl->getId());
      Severity: Minor
      Found in FML/Script/Features/Tooltip.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 '\FML\Script\Builder' in method 'prepare'.
      Open

              $visibility = Builder::getBoolean(!$this->invert);
      Severity: Minor
      Found in FML/Script/Features/Tooltip.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 '\FML\Script\Builder' in method 'prepare'.
      Open

                  $tooltipText = Builder::escapeText($this->text);
      Severity: Minor
      Found in FML/Script/Features/Tooltip.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 '\FML\Script\Builder' in method 'prepare'.
      Open

              $hoverControlId   = Builder::escapeText($this->hoverControl->getId());
      Severity: Minor
      Found in FML/Script/Features/Tooltip.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 '\FML\Script\Builder' in method 'prepare'.
      Open

              $visibility = Builder::getBoolean($this->invert);
      Severity: Minor
      Found in FML/Script/Features/Tooltip.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

      The closing brace for the class must go on the next line after the body
      Open

      }

      The 'getStayOnClick()' method which returns a boolean should be named 'is...()' or 'has...()'
      Open

          public function getStayOnClick()
          {
              return $this->stayOnClick;
          }
      Severity: Minor
      Found in FML/Script/Features/Tooltip.php by phpmd

      BooleanGetMethodName

      Since: 0.2

      Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

      Example

      class Foo {
          /**
           * @return boolean
           */
          public function getFoo() {} // bad
          /**
           * @return bool
           */
          public function isFoo(); // ok
          /**
           * @return boolean
           */
          public function getFoo($bar); // ok, unless checkParameterizedMethods=true
      }

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

      The 'getInvert()' method which returns a boolean should be named 'is...()' or 'has...()'
      Open

          public function getInvert()
          {
              return $this->invert;
          }
      Severity: Minor
      Found in FML/Script/Features/Tooltip.php by phpmd

      BooleanGetMethodName

      Since: 0.2

      Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

      Example

      class Foo {
          /**
           * @return boolean
           */
          public function getFoo() {} // bad
          /**
           * @return bool
           */
          public function isFoo(); // ok
          /**
           * @return boolean
           */
          public function getFoo($bar); // ok, unless checkParameterizedMethods=true
      }

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

      Line exceeds 120 characters; contains 144 characters
      Open

          public function __construct(Control $hoverControl = null, Control $tooltipControl = null, $stayOnClick = null, $invert = null, $text = null)

      There are no issues that match your filters.

      Category
      Status