Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
namespace FML\Controls\Quads;
use FML\Controls\Quad;
- 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 100.
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
The class Quad_Copilot is not named in CamelCase. Open
class Quad_Copilot extends Quad
{
/*
* Constants
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Class constants must be uppercase; expected SUBSTYLE_LEFTWRONG but found SUBSTYLE_LeftWrong Open
const SUBSTYLE_LeftWrong = 'LeftWrong';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_DOWN but found SUBSTYLE_Down Open
const SUBSTYLE_Down = 'Down';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_LEFT but found SUBSTYLE_Left Open
const SUBSTYLE_Left = 'Left';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_DOWNWRONG but found SUBSTYLE_DownWrong Open
const SUBSTYLE_DownWrong = 'DownWrong';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_RIGHTGOOD but found SUBSTYLE_RightGood Open
const SUBSTYLE_RightGood = 'RightGood';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_RIGHTWRONG but found SUBSTYLE_RightWrong Open
const SUBSTYLE_RightWrong = 'RightWrong';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_UPWRONG but found SUBSTYLE_UpWrong Open
const SUBSTYLE_UpWrong = 'UpWrong';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_UPGOOD but found SUBSTYLE_UpGood Open
const SUBSTYLE_UpGood = 'UpGood';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_RIGHT but found SUBSTYLE_Right Open
const SUBSTYLE_Right = 'Right';
- Exclude checks
The closing brace for the class must go on the next line after the body Open
}
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_DOWNGOOD but found SUBSTYLE_DownGood Open
const SUBSTYLE_DownGood = 'DownGood';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_LEFTGOOD but found SUBSTYLE_LeftGood Open
const SUBSTYLE_LeftGood = 'LeftGood';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_UP but found SUBSTYLE_Up Open
const SUBSTYLE_Up = 'Up';
- Exclude checks
Constant SUBSTYLE_Up should be defined in uppercase Open
const SUBSTYLE_Up = 'Up';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_RightGood should be defined in uppercase Open
const SUBSTYLE_RightGood = 'RightGood';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_DownWrong should be defined in uppercase Open
const SUBSTYLE_DownWrong = 'DownWrong';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_Left should be defined in uppercase Open
const SUBSTYLE_Left = 'Left';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_LeftGood should be defined in uppercase Open
const SUBSTYLE_LeftGood = 'LeftGood';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_Right should be defined in uppercase Open
const SUBSTYLE_Right = 'Right';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_UpGood should be defined in uppercase Open
const SUBSTYLE_UpGood = 'UpGood';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_Down should be defined in uppercase Open
const SUBSTYLE_Down = 'Down';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_DownGood should be defined in uppercase Open
const SUBSTYLE_DownGood = 'DownGood';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_RightWrong should be defined in uppercase Open
const SUBSTYLE_RightWrong = 'RightWrong';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_LeftWrong should be defined in uppercase Open
const SUBSTYLE_LeftWrong = 'LeftWrong';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant SUBSTYLE_UpWrong should be defined in uppercase Open
const SUBSTYLE_UpWrong = 'UpWrong';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Class name "Quad_Copilot" is not in camel caps format Open
class Quad_Copilot extends Quad
- Exclude checks