src/MathParser/Interpreting/Evaluator.php
Method visitFunctionNode
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitFunctionNode(FunctionNode $node)
{
$inner = $node->getOperand()->accept($this);
switch ($node->getName()) {
Method visitExpressionNode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitExpressionNode(ExpressionNode $node)
{
$operator = $node->getOperator();
$leftValue = $node->getLeft()->accept($this);
Avoid too many return
statements within this method. Open
Open
return atanh(1 / $inner);
Avoid too many return
statements within this method. Open
Open
return exp($rightValue);
Avoid too many return
statements within this method. Open
Open
return cosh($inner);
Avoid too many return
statements within this method. Open
Open
return tanh($inner);
Avoid too many return
statements within this method. Open
Open
return asinh($inner);
Avoid too many return
statements within this method. Open
Open
return exp($logGamma);
Avoid too many return
statements within this method. Open
Open
return cos(deg2rad($inner));
Avoid too many return
statements within this method. Open
Open
return sinh($inner);
Avoid too many return
statements within this method. Open
Open
return atanh($inner);
Avoid too many return
statements within this method. Open
Open
return NAN;
Avoid too many return
statements within this method. Open
Open
return exp($inner);
Avoid too many return
statements within this method. Open
Open
return pow($leftValue, $rightValue);
Avoid too many return
statements within this method. Open
Open
return asin($inner);
Avoid too many return
statements within this method. Open
Open
return 1 / $tanh_inner;
Avoid too many return
statements within this method. Open
Open
return atan($inner);
Avoid too many return
statements within this method. Open
Open
return log($inner);
Avoid too many return
statements within this method. Open
Open
return $inner >= 0 ? 1 : -1;
Avoid too many return
statements within this method. Open
Open
return round($inner);
Avoid too many return
statements within this method. Open
Open
return tan(deg2rad($inner));
Avoid too many return
statements within this method. Open
Open
return ceil($inner);
Avoid too many return
statements within this method. Open
Open
return pi() / 2 - atan($inner);
Avoid too many return
statements within this method. Open
Open
return Math::SemiFactorial($inner);
Avoid too many return
statements within this method. Open
Open
return acos($inner);
Avoid too many return
statements within this method. Open
Open
return 1 / $tan_inner;
Avoid too many return
statements within this method. Open
Open
return sqrt($inner);
Avoid too many return
statements within this method. Open
Open
return sin(deg2rad($inner));
Avoid too many return
statements within this method. Open
Open
return 1 / $tan_inner;
Avoid too many return
statements within this method. Open
Open
return log10($inner);
Avoid too many return
statements within this method. Open
Open
return NAN;
Avoid too many return
statements within this method. Open
Open
return acosh($inner);
Avoid too many return
statements within this method. Open
Open
return abs($inner);
Avoid too many return
statements within this method. Open
Open
return floor($inner);
Function visitExpressionNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function visitExpressionNode(ExpressionNode $node)
{
$operator = $node->getOperator();
$leftValue = $node->getLeft()->accept($this);
- Read upRead up
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"