Function split
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
private function split(string $query): Collection
{
$out = [];
$pos = 0;
- 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
File Expression.php
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CPB\Utilities\Parser
{
use CPB\Utilities\Collections\Collection;
Method split
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function split(string $query): Collection
{
$out = [];
$pos = 0;
Method parseOperator
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseOperator($left, ?string $operator, $right)
{
switch($operator)
{
// NOTE(Chris Kruining)
Method resolveKey
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveKey($key)
{
$trimmed = \trim($key);
if(\strlen($trimmed) === 0)
Function parseParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function parseParameters(string $parameters): Collection
{
$out = [];
$pos = 0;
$level = 0;
- 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 parseParameters
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseParameters(string $parameters): Collection
{
$out = [];
$pos = 0;
$level = 0;
Function parseOperator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function parseOperator($left, ?string $operator, $right)
{
switch($operator)
{
// NOTE(Chris Kruining)
- 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 null;
Avoid too many return
statements within this method. Open
return $callable(...$parameters);
Avoid too many return
statements within this method. Open
return $this->resolvable->{substr($trimmed, 1)};
Avoid too many return
statements within this method. Open
return $this->resolvable->$callable(...$parameters);
Avoid too many return
statements within this method. Open
return $this->variables[substr($trimmed, 2, -2)];
Avoid too many return
statements within this method. Open
return $key;
Avoid too many return
statements within this method. Open
return $this->resolvable->resolve(substr($trimmed, 1));
Avoid too many return
statements within this method. Open
return $right;
Avoid too many return
statements within this method. Open
return static::init(substr($trimmed, 1, -1))($this->resolvable, $this->variables);