src/Solving/StdMathEvaluator.php
Method visitFunctionNode
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitFunctionNode(FunctionNode $node): float|int
{
if ($node->operand === null) {
throw new NullOperandException();
}
Function visitInfixExpressionNode
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
public function visitInfixExpressionNode(InfixExpressionNode $node): float
{
$left = $node->getLeft();
$operator = $node->operator;
$right = $node->getRight();
- 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"
Further reading
Method visitInfixExpressionNode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitInfixExpressionNode(InfixExpressionNode $node): float
{
$left = $node->getLeft();
$operator = $node->operator;
$right = $node->getRight();
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 sinh($inner);
Avoid too many return
statements within this method. Open
Open
return cosh($inner);
Avoid too many return
statements within this method. Open
Open
return asin($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 1 / $tan_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 cos(deg2rad($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 acosh($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 atanh(1 / $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 sqrt($inner);
Avoid too many return
statements within this method. Open
Open
return NAN;
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 acos($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 1 / $tanh_inner;
Avoid too many return
statements within this method. Open
Open
return M_PI / 2 - atan($inner);
Avoid too many return
statements within this method. Open
Open
return Math::semiFactorial((int)$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 asinh($inner);
Avoid too many return
statements within this method. Open
Open
return NAN;
Avoid too many return
statements within this method. Open
Open
return round($inner);
Avoid too many return
statements within this method. Open
Open
return exp($inner);
Avoid too many return
statements within this method. Open
Open
return floor($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 atan($inner);
Avoid too many return
statements within this method. Open
Open
return exp($logGamma);
Function visitFunctionNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function visitFunctionNode(FunctionNode $node): float|int
{
if ($node->operand === null) {
throw new NullOperandException();
}
- 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"