robotomize/fujes

View on GitHub
src/robotomize/Fujes/SearchFacade.php

Summary

Maintainability
A
3 hrs
Test Coverage

SearchFacade has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class SearchFacade
{

    /**
     * @var string
Severity: Minor
Found in src/robotomize/Fujes/SearchFacade.php - About 2 hrs to fix

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

            $urlName,
            $matchString,
            $depth = 1,
            $jsonEncode = true,
            $multipleResult = false,
    Severity: Major
    Found in src/robotomize/Fujes/SearchFacade.php - About 50 mins to fix

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

              $jsonEncode = true,
      Severity: Minor
      Found in src/robotomize/Fujes/SearchFacade.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

      Missing class import via use statement (line '85', column '23').
      Open

                  throw new \InvalidArgumentException;
      Severity: Minor
      Found in src/robotomize/Fujes/SearchFacade.php by phpmd

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

              $multipleResult = false,
      Severity: Minor
      Found in src/robotomize/Fujes/SearchFacade.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $this->urlName = $urlName;
                  $this->matchString = mb_strtolower($matchString);
                  $this->depth = $depth;
                  $this->jsonEncode = $jsonEncode;
      Severity: Minor
      Found in src/robotomize/Fujes/SearchFacade.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 __toString uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  return $this->fetchOne();
              }
      Severity: Minor
      Found in src/robotomize/Fujes/SearchFacade.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 'getMultipleResult()' method which returns a boolean should be named 'is...()' or 'has...()'
      Open

          public function getMultipleResult()
          {
              return $this->multipleResult;
          }
      Severity: Minor
      Found in src/robotomize/Fujes/SearchFacade.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

      There are no issues that match your filters.

      Category
      Status