Showing 161 of 161 total issues
Method getProvider
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProvider()
{
$pdo = $this->getMockBuilder('\PDO')
->disableOriginalConstructor()
->getMock();
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
Method testBag_cast
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBag_cast()
{
$bag = new PgSqlBag();
$cast = $bag->get('cast');
ExtendedBuilderTest
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ExtendedBuilderTest extends AbstractBuilderTest
{
public function testSelect()
{
Method testIsOnlyOption
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testIsOnlyOption()
{
$model = $this->getModel();
$this->assertTrue(
File TypeBag.php
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace ChrisAndChris\Common\RowMapperBundle\Services\Query\Parser;
use ChrisAndChris\Common\RowMapperBundle\Exceptions\InvalidOptionException;
Method getModel
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModel(
$calcRowCapable = false,
SqlQuery $queryMock = null
) {
$dependencyMock =
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 run
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(
\Closure $process,
$eventClass = null,
$eventData = null
) {
Method testAppendMultipleWrongInput
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAppendMultipleWrongInput()
{
$builder = $this->getBuilder();
$array = [0];
try {
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace ChrisAndChris\Common\RowMapperBundle\Events\Transmitters;
use ChrisAndChris\Common\RowMapperBundle\Exceptions\ClassNotFoundException;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace ChrisAndChris\Common\RowMapperBundle\Events\Transmitters;
use ChrisAndChris\Common\RowMapperBundle\Exceptions\ClassNotFoundException;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method testSimpleQuery
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function testSimpleQuery()
{
// @formatter:off
$builder = $this->getBuilder();
$builder->select()
Method testRun
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRun()
{
$mock =
$this->getMockBuilder('\ChrisAndChris\Common\RowMapperBundle\Services\Pdo\PdoLayer')
->disableOriginalConstructor()
Method testUpdates
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testUpdates()
{
$builder = $this->getBuilder();
$builder->updates(
Method logOut
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function logOut(
$start,
$eventClass = null,
$result = null,
$eventData = null
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);
Function runCustom
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function runCustom(
SqlQuery $query,
$onSuccess,
$onFailure,
$onError = 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
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))
Method testAppendMultiple
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testAppendMultiple()
{
$builder = $this->getBuilder();
$array = [0];
$builder->each(