File Parser.php
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace MyEval\Parsing;
Parser
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser
{
use Numeric;
/**
Method processToken
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processToken(Token $token): void
{
$node = Node::factory($token);
switch (get_class($node)) {
Function processToken
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function processToken(Token $token): void
{
$node = Node::factory($token);
switch (get_class($node)) {
- 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
Function isUnary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function isUnary(Node $node, ?Node $lastNode): bool
{
if (!$node instanceof InfixExpressionNode) {
return false;
}
- 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
Function populateNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function populateNode(AbstractOperatorNode $node): Node
{
if ($node instanceof FunctionNode) {
throw new DelimeterMismatchException($node->operator);
}
- 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
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Function handleCloseParenthesis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function handleCloseParenthesis(): void
{
// Flag, checking for mismatching parentheses.
$clean = false;
- 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
Function handleInfixOperator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function handleInfixOperator(InfixExpressionNode $node, Token $token, ?Node $lastNode): void
{
// Check for unary minus and unary plus.
if ($this->isUnary($node, $lastNode)) {
// Unary +, just ignore it.
- 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"