mossadal/math-parser

View on GitHub
src/MathParser/Interpreting/Evaluator.php

Summary

Maintainability
D
2 days
Test Coverage

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

    public function visitFunctionNode(FunctionNode $node)
    {
        $inner = $node->getOperand()->accept($this);

        switch ($node->getName()) {
Severity: Major
Found in src/MathParser/Interpreting/Evaluator.php - About 3 hrs to fix

    Method visitExpressionNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function visitExpressionNode(ExpressionNode $node)
        {
            $operator = $node->getOperator();
    
            $leftValue = $node->getLeft()->accept($this);
    Severity: Minor
    Found in src/MathParser/Interpreting/Evaluator.php - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

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

        Avoid too many return statements within this method.
        Open

                            return exp($rightValue);
        Severity: Major
        Found in src/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

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

                Avoid too many return statements within this method.
                Open

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

                  Avoid too many return statements within this method.
                  Open

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

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

                                            return NAN;
                        Severity: Major
                        Found in src/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

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

                            Avoid too many return statements within this method.
                            Open

                                                return pow($leftValue, $rightValue);
                            Severity: Major
                            Found in src/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

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

                                  Avoid too many return statements within this method.
                                  Open

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

                                    Avoid too many return statements within this method.
                                    Open

                                                    return log($inner);
                                    Severity: Major
                                    Found in src/MathParser/Interpreting/Evaluator.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/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

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

                                          Avoid too many return statements within this method.
                                          Open

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

                                            Avoid too many return statements within this method.
                                            Open

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

                                              Avoid too many return statements within this method.
                                              Open

                                                              return pi() / 2 - atan($inner);
                                              Severity: Major
                                              Found in src/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                return Math::SemiFactorial($inner);
                                                Severity: Major
                                                Found in src/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

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

                                                      Avoid too many return statements within this method.
                                                      Open

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

                                                        Avoid too many return statements within this method.
                                                        Open

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

                                                          Avoid too many return statements within this method.
                                                          Open

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

                                                            Avoid too many return statements within this method.
                                                            Open

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

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                                  return NAN;
                                                              Severity: Major
                                                              Found in src/MathParser/Interpreting/Evaluator.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

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

                                                                  Avoid too many return statements within this method.
                                                                  Open

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

                                                                    Avoid too many return statements within this method.
                                                                    Open

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

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

                                                                          public function visitExpressionNode(ExpressionNode $node)
                                                                          {
                                                                              $operator = $node->getOperator();
                                                                      
                                                                              $leftValue = $node->getLeft()->accept($this);
                                                                      Severity: Minor
                                                                      Found in src/MathParser/Interpreting/Evaluator.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