Showing 29 of 38 total issues
File ResolverTest.php
has 462 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Ctrl\Common\Test\Criteria;
use Ctrl\Common\Criteria\Resolver;
Function parseGraph
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function parseGraph(array $graph = array(), array &$values, &$currentKey)
{
$type = key($graph);
$parsed = [];
$joins = [];
- 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 createQueryExpression
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function createQueryExpression(QueryBuilder $qb, array $graph = array())
{
$key = key($graph);
$expr = null;
- 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 tokenize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function tokenize(array $expressions)
{
$tokens = array();
foreach ($expressions as $expr) {
- 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 createQueryExpression
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createQueryExpression(QueryBuilder $qb, array $graph = array())
{
$key = key($graph);
$expr = null;
File Resolver.php
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Ctrl\Common\Criteria;
use Ctrl\Common\Tools\StringHelper;
Function getFieldConfig
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function getFieldConfig($expr, $root)
{
if (strpos($expr, ' ') === false) {
$field = $expr;
$condition = '=';
- 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 getFieldConfig
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFieldConfig($expr, $root)
{
if (strpos($expr, ' ') === false) {
$field = $expr;
$condition = '=';
Method test_resolve_string_braces
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_resolve_string_braces()
{
$resolver = $this->getResolver('root');
$result = $resolver->resolveCriteria('root.id = 1 and (id IS NULL or root.active = false)');
Function resolveCriteria
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function resolveCriteria($criteria, $type = self::T_AND)
{
if (!is_array($criteria)) {
$criteria = array($criteria);
}
- 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 test_resolve_conditions_with_mixed_parameters
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_resolve_conditions_with_mixed_parameters()
{
$resolver = $this->getResolver('root');
$result = $resolver->resolveCriteria([
Function bracesToArray
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function bracesToArray($string, $braces = self::BRACKET_ROUND, $first = true)
{
$OPEN = $braces[0];
$CLOSE = $braces[1];
$result = array();
- 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 parseGraph
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseGraph(array $graph = array(), array &$values, &$currentKey)
{
$type = key($graph);
$parsed = [];
$joins = [];
Method resolveCriteria
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resolveCriteria($criteria, $type = self::T_AND)
{
if (!is_array($criteria)) {
$criteria = array($criteria);
}
Function createGraph
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function createGraph($tokens)
{
if (is_string($tokens)) {
$tokens = $this->tokenize(StringHelper::bracesToArray($tokens));
}
- 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 bracesToArray
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function bracesToArray($string, $braces = self::BRACKET_ROUND, $first = true)
{
$OPEN = $braces[0];
$CLOSE = $braces[1];
$result = array();
Method test_resolve_conditions_with_named_parameters
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_resolve_conditions_with_named_parameters()
{
$resolver = $this->getResolver('root');
$result = $resolver->resolveCriteria(array('id = :id' => ['id' => 1]));
Method test_resolve_conditions_with_parameters
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_resolve_conditions_with_parameters()
{
$resolver = $this->getResolver('root');
$result = $resolver->resolveCriteria(array('root.id' => 1));
Method test_create_graph
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_create_graph()
{
$resolver = $this->getResolver('root');
$result = $resolver->createGraph('test');
Method test_resolve_array_with_values
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_resolve_array_with_values()
{
$resolver = $this->getResolver('root');
$result = $resolver->resolveCriteria(array('id' => 1));