vindi/vindi-woocommerce

View on GitHub
src/validators/Dependencies.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method check has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function check()
    {
        if(!self::check_critical_dependencies()) {
            return false;
        }
Severity: Minor
Found in src/validators/Dependencies.php - About 1 hr to fix

    Method check_critical_dependencies has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function check_critical_dependencies()
        {
            $critical_dependencies = [
                [
                    'name'    => 'PHP',
    Severity: Minor
    Found in src/validators/Dependencies.php - About 1 hr to fix

      Avoid using undefined variables such as '$plugin' which will lead to PHP notices.
      Open

                      array_push($errors, $plugin);
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

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

      Avoid unused parameters such as '$name'.
      Open

          public static function critical_dependency_missing_notice($name, $version)
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      Avoid unused parameters such as '$version'.
      Open

          public static function critical_dependency_missing_notice($name, $version)
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      Avoid unused parameters such as '$link'.
      Open

          public static function missing_notice($name, $version, $link)
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      Avoid unused parameters such as '$version'.
      Open

          public static function missing_notice($name, $version, $link)
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      Avoid unused local variables such as '$plugin'.
      Open

                      array_push($errors, $plugin);
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused parameters such as '$name'.
      Open

          public static function missing_notice($name, $version, $link)
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

      The property $active_plugins is not named in camelCase.
      Open

      class VindiDependencies
      {
          /**
          * @var array
          */
      Severity: Minor
      Found in src/validators/Dependencies.php by phpmd

      CamelCasePropertyName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name attributes.

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      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 9 and the first side effect is on line 6.
      Open

      <?php

      Expected 1 space after IF keyword; 0 found
      Open

              if(!self::check_critical_dependencies()) {

      Expected 1 space after IF keyword; 0 found
      Open

              if(!empty($errors)) {

      There are no issues that match your filters.

      Category
      Status