Showing 13 of 13 total issues
Function buildTree
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
protected function buildTree(int $i = 0, array &$children = [])
{
$max = \count($this->trace);
while ($i < $max) {
- 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 buildTree
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildTree(int $i = 0, array &$children = [])
{
$max = \count($this->trace);
while ($i < $max) {
Function renderAttributes
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function renderAttributes(\DOMDocument $root, \DOMElement $node, $ast): void
{
$reflection = new \ReflectionObject($ast);
/** @var \ReflectionProperty[] $properties */
- 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
Parser
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser implements ParserInterface
{
/**
* @var LexerInterface
*/
Function renderAsXml
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function renderAsXml(\DOMDocument $root, $ast): \DOMElement
{
if ($ast instanceof LeafInterface) {
$token = $this->createElement($root, $this->getName($ast), $ast->getValue());
$this->renderAttributes($root, $token, $ast);
- 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 extend
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function extend(string $ruleId, \Closure $then): ParserInterface
{
$maxId = \count($this->grammar->getRules()) - 1;
$result = $then($this->grammar->fetch($ruleId), $maxId);
- 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 renderAttributes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function renderAttributes(\DOMDocument $root, \DOMElement $node, $ast): void
{
$reflection = new \ReflectionObject($ast);
/** @var \ReflectionProperty[] $properties */
Function unfold
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function unfold(): bool
{
while (0 < \count($this->todo)) {
$rule = \array_pop($this->todo);
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($name, $min, $max, $children, string $nodeId = null)
Function backtrack
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function backtrack(): bool
{
$found = false;
do {
- 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 false;
Avoid too many return
statements within this method. Open
return $this->parseRepetition($current, $next);
Function findChildren
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function findChildren(RuleInterface $rule, string $name, int $depth): iterable
{
foreach ($rule->getChildren() as $child) {
if ($child->getName() === $name) {
yield $child;
- 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"