File Builder.php
has 580 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace ChrisAndChris\Common\RowMapperBundle\Services\Query;
use ChrisAndChris\Common\RowMapperBundle\Exceptions\MalformedQueryException;
use ChrisAndChris\Common\RowMapperBundle\Exceptions\MissingParameterException;
Builder
has 59 functions (exceeds 20 allowed). Consider refactoring. Open
class Builder
{
/** @var array the statement */
private $statement = [];
Function append
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private function append($typeName, array $params = [])
{
if ($this->allowAppend() && $this->typeBag->has($typeName)) {
$endParams = [];
$type = $this->typeBag->get($typeName);
- 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 values
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function values(array $values = [])
{
if (is_array($values) && count($values) > 0) {
$this->append('values');
- 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 updates
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function updates(array $updates)
{
if (count($updates) < 1) {
throw new MalformedQueryException(
sprintf('Must update at least one field, %s given', count($updates))
- 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 append
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function append($typeName, array $params = [])
{
if ($this->allowAppend() && $this->typeBag->has($typeName)) {
$endParams = [];
$type = $this->typeBag->get($typeName);
Method updates
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updates(array $updates)
{
if (count($updates) < 1) {
throw new MalformedQueryException(
sprintf('Must update at least one field, %s given', count($updates))
Function getSqlQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getSqlQuery(ParserInterface $parser = null)
{
if ($this->parser === null && $parser === null) {
throw new SystemException('No parser given');
}
- 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 getSqlQuery
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSqlQuery(ParserInterface $parser = null)
{
if ($this->parser === null && $parser === null) {
throw new SystemException('No parser given');
}
Method values
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function values(array $values = [])
{
if (is_array($values) && count($values) > 0) {
$this->append('values');
Function appendMultiple
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function appendMultiple($types)
{
if ($types instanceof Builder) {
$types = $types->getStatement();
} else {
- 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 allowAppend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function allowAppend()
{
// for speed, we first check only the last index
// if the last index says we should append, we check all other indexes
// any of the index must be 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 combine
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function combine($builder)
{
if (!$this->allowAppend() || $builder === null) {
return $this;
}
- 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 orderBy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function orderBy(array $orders)
{
$this->append('order');
$idx = 0;
foreach ($orders as $field => $direction) {
- 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"