j84reginato/my-eval

View on GitHub
src/Solving/StdMathEvaluator.php

Summary

Maintainability
D
2 days
Test Coverage

Method visitFunctionNode has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function visitFunctionNode(FunctionNode $node): float|int
    {
        if ($node->operand === null) {
            throw new NullOperandException();
        }
Severity: Major
Found in src/Solving/StdMathEvaluator.php - About 3 hrs to fix

    Function visitInfixExpressionNode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function visitInfixExpressionNode(InfixExpressionNode $node): float
        {
            $left     = $node->getLeft();
            $operator = $node->operator;
            $right    = $node->getRight();
    Severity: Minor
    Found in src/Solving/StdMathEvaluator.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 visitInfixExpressionNode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function visitInfixExpressionNode(InfixExpressionNode $node): float
        {
            $left     = $node->getLeft();
            $operator = $node->operator;
            $right    = $node->getRight();
    Severity: Minor
    Found in src/Solving/StdMathEvaluator.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

                      return tan(deg2rad($inner));
      Severity: Major
      Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return sinh($inner);
        Severity: Major
        Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return cosh($inner);
          Severity: Major
          Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return asin($inner);
            Severity: Major
            Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return log10($inner);
              Severity: Major
              Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return 1 / $tan_inner;
                Severity: Major
                Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return sin(deg2rad($inner));
                  Severity: Major
                  Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return cos(deg2rad($inner));
                    Severity: Major
                    Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return tanh($inner);
                      Severity: Major
                      Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return acosh($inner);
                        Severity: Major
                        Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return atanh($inner);
                          Severity: Major
                          Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return atanh(1 / $inner);
                            Severity: Major
                            Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return log($inner);
                              Severity: Major
                              Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return sqrt($inner);
                                Severity: Major
                                Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return NAN;
                                  Severity: Major
                                  Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                    return $inner >= 0 ? 1 : -1;
                                    Severity: Major
                                    Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                      return acos($inner);
                                      Severity: Major
                                      Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                        return abs($inner);
                                        Severity: Major
                                        Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return 1 / $tanh_inner;
                                          Severity: Major
                                          Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                            return M_PI / 2 - atan($inner);
                                            Severity: Major
                                            Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return Math::semiFactorial((int)$inner);
                                              Severity: Major
                                              Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                return ceil($inner);
                                                Severity: Major
                                                Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  return asinh($inner);
                                                  Severity: Major
                                                  Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                        return NAN;
                                                    Severity: Major
                                                    Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return round($inner);
                                                      Severity: Major
                                                      Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                        return exp($inner);
                                                        Severity: Major
                                                        Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                          return floor($inner);
                                                          Severity: Major
                                                          Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return 1 / $tan_inner;
                                                            Severity: Major
                                                            Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return atan($inner);
                                                              Severity: Major
                                                              Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return exp($logGamma);
                                                                Severity: Major
                                                                Found in src/Solving/StdMathEvaluator.php - About 30 mins to fix

                                                                  Function visitFunctionNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      public function visitFunctionNode(FunctionNode $node): float|int
                                                                      {
                                                                          if ($node->operand === null) {
                                                                              throw new NullOperandException();
                                                                          }
                                                                  Severity: Minor
                                                                  Found in src/Solving/StdMathEvaluator.php - About 25 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

                                                                  There are no issues that match your filters.

                                                                  Category
                                                                  Status