robotomize/fujes

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

Summary

Maintainability
D
2 days
Test Coverage

SearchEngine has 39 functions (exceeds 20 allowed). Consider refactoring.
Open

class SearchEngine
{
    /**
     * @var string
     */
Severity: Minor
Found in src/robotomize/Fujes/SearchEngine.php - About 5 hrs to fix

    File SearchEngine.php has 369 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
        /**
         * This file is part of the Fujes package.
         * @link    https://github.com/robotomize/fujes
         * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
    Severity: Minor
    Found in src/robotomize/Fujes/SearchEngine.php - About 4 hrs to fix

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

      class SearchEngine
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.php by phpmd

      Function __construct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct(
              $urlName,
              $matchString,
              $depth = 1,
              $jsonEncode = true,
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.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

      The class SearchEngine has 26 fields. Consider redesigning SearchEngine to keep the number of fields under 15.
      Open

      class SearchEngine
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.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

      Method run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run()
          {
              $this->parseJsonToArray();
              if (0 === count($this->jsonTree)) {
                  $this->exceptionObject->create('The data is not in JSON format');
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.php - About 1 hr to fix

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

            public function __construct(
                $urlName,
                $matchString,
                $depth = 1,
                $jsonEncode = true,
        Severity: Minor
        Found in src/robotomize/Fujes/SearchEngine.php - About 1 hr to fix

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

              public function run()
              {
                  $this->parseJsonToArray();
                  if (0 === count($this->jsonTree)) {
                      $this->exceptionObject->create('The data is not in JSON format');
          Severity: Minor
          Found in src/robotomize/Fujes/SearchEngine.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 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function outputInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function outputInfo()
                {
                    if ($this->jsonEncode) {
                        if (empty($this->moreJsonTreesOnString)) {
                            $this->logger->pushFlashMsg('error');
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.php - About 45 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

            Function parseJsonToArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function parseJsonToArray()
                {
                    if (file_exists($this->urlName)) {
                        $this->jsonData = file_get_contents($this->urlName);
                    } else {
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.php - About 35 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

            Function createResultArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function createResultArray($relevantArray)
                {
                    if (0 === count($relevantArray)) {
                        $relevantArray = $this->relevantTree;
                    }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.php - About 35 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 __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/SearchEngine.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 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/SearchEngine.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);
            
                        if (is_int($depth)) {
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->jsonEncode = self::$jsonEncodeDefault;
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

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

                        } else {
                            $this->depth = self::$depthDefault;
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 using static access to class '\robotomize\Utils\Json' in method 'parseJsonToArray'.
            Open

                            $this->jsonTree = Json::jsonDecode(trim($this->jsonData), true);
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 method run uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        return false;
                    }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 using static access to class '\robotomize\Utils\Json' in method 'fetchOne'.
            Open

                    $result = Json::jsonEncode($branchArray, $this->relevantTree, $this->jsonEncode);
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 method outputInfo uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        if (0 === count($this->moreRelevantJsonTreesOnArray)) {
                            $this->logger->pushFlashMsg('error');
                            return $this->errorMessage;
                        } else {
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 parseJsonToArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $this->jsonData = Network::curlWrap($this->urlName);
                        if (trim($this->jsonData) == '') {
                            $this->exceptionObject->create('Input file not found');
                            throw new FileNotFoundException('Input file not found');
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 using static access to class '\robotomize\Utils\Json' in method 'generateOutputData'.
            Open

                                Json::jsonEncode($branchArray, $this->relevantTree, $this->jsonEncode);
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 method fetchFew 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/SearchEngine.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 run uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        /**
                         * Calculating matrix with scores
                         */
                        $searchObj->search();
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 outputInfo uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->logger->pushFlashMsg('info');
                            return $this->moreJsonTreesOnString;
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->quality = self::$qualityDefault;
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 preCompilationDirectMatch uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        return false;
                    }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 createResultArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

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

                        } else {
                            $searchObj->relevantCalc();
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 createResultArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $needleBranch = $needleBranch[$vv];
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 using static access to class '\robotomize\Utils\Network' in method 'parseJsonToArray'.
            Open

                        $this->jsonData = Network::curlWrap($this->urlName);
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 method outputInfo uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->logger->pushFlashMsg('info');
                            return $this->moreRelevantJsonTreesOnArray;
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 Json::jsonEncode($this->relevantTree, $this->relevantTree, $this->jsonEncode);
                    }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 using static access to class '\robotomize\Utils\Json' in method 'generateOutputData'.
            Open

                            $this->moreJsonTreesOnString .= Json::jsonEncode($branchArray, $this->relevantTree, $this->jsonEncode);
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 '\robotomize\Utils\Json' in method 'parseJsonToArray'.
            Open

                    if (Json::isJsonTest($this->jsonData)) {
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 '\robotomize\Utils\Json' in method '__toString'.
            Open

                        return Json::jsonEncode($this->relevantTree, $this->relevantTree, $this->jsonEncode);
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 method fetchOne uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $this->logger->pushFlashMsg('info');
                        return $result;
                    }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 generateOutputData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->moreRelevantJsonTreesOnArray[] =
                                Json::jsonEncode($branchArray, $this->relevantTree, $this->jsonEncode);
                        }
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.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 __invoke 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/SearchEngine.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 excessively long variable names like $moreRelevantJsonTreesOnArray. Keep variable name length under 20.
            Open

                private $moreRelevantJsonTreesOnArray = [];
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.php by phpmd

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

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

            Avoid excessively long variable names like $multipleResultDefault. Keep variable name length under 20.
            Open

                private static $multipleResultDefault = false;
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.php by phpmd

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

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

            Avoid excessively long variable names like $moreJsonTreesOnString. Keep variable name length under 20.
            Open

                private $moreJsonTreesOnString = '';
            Severity: Minor
            Found in src/robotomize/Fujes/SearchEngine.php by phpmd

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

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

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }

            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/SearchEngine.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 'getJsonEncode()' method which returns a boolean should be named 'is...()' or 'has...()'
            Open

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