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_UIConstruction_Buttons2 is not named in CamelCase. Open
class Quad_UIConstruction_Buttons2 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_KEYSDELETE but found SUBSTYLE_KeysDelete Open
const SUBSTYLE_KeysDelete = 'KeysDelete';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_KEYSPASTE but found SUBSTYLE_KeysPaste Open
const SUBSTYLE_KeysPaste = 'KeysPaste';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_KEYSCOPY but found SUBSTYLE_KeysCopy Open
const SUBSTYLE_KeysCopy = 'KeysCopy';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_OPEN but found SUBSTYLE_Open Open
const SUBSTYLE_Open = 'Open';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_GHOSTBLOCKS but found SUBSTYLE_GhostBlocks Open
const SUBSTYLE_GhostBlocks = 'GhostBlocks';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_SYMMETRY but found SUBSTYLE_Symmetry Open
const SUBSTYLE_Symmetry = 'Symmetry';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_BLOCKEDITOR but found SUBSTYLE_BlockEditor Open
const SUBSTYLE_BlockEditor = 'BlockEditor';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_COPY but found SUBSTYLE_Copy Open
const SUBSTYLE_Copy = 'Copy';
- 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_AIRMAPPING but found SUBSTYLE_AirMapping Open
const SUBSTYLE_AirMapping = 'AirMapping';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_CUT but found SUBSTYLE_Cut Open
const SUBSTYLE_Cut = 'Cut';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_KEYSADD but found SUBSTYLE_KeysAdd Open
const SUBSTYLE_KeysAdd = 'KeysAdd';
- Exclude checks
Class constants must be uppercase; expected SUBSTYLE_NEW but found SUBSTYLE_New Open
const SUBSTYLE_New = 'New';
- Exclude checks
Constant SUBSTYLE_AirMapping should be defined in uppercase Open
const SUBSTYLE_AirMapping = 'AirMapping';
- 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_KeysDelete should be defined in uppercase Open
const SUBSTYLE_KeysDelete = 'KeysDelete';
- 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_Open should be defined in uppercase Open
const SUBSTYLE_Open = 'Open';
- 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_Copy should be defined in uppercase Open
const SUBSTYLE_Copy = 'Copy';
- 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_KeysAdd should be defined in uppercase Open
const SUBSTYLE_KeysAdd = 'KeysAdd';
- 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_Symmetry should be defined in uppercase Open
const SUBSTYLE_Symmetry = 'Symmetry';
- 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_New should be defined in uppercase Open
const SUBSTYLE_New = 'New';
- 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_GhostBlocks should be defined in uppercase Open
const SUBSTYLE_GhostBlocks = 'GhostBlocks';
- 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_KeysPaste should be defined in uppercase Open
const SUBSTYLE_KeysPaste = 'KeysPaste';
- 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_BlockEditor should be defined in uppercase Open
const SUBSTYLE_BlockEditor = 'BlockEditor';
- 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_Cut should be defined in uppercase Open
const SUBSTYLE_Cut = 'Cut';
- 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_KeysCopy should be defined in uppercase Open
const SUBSTYLE_KeysCopy = 'KeysCopy';
- 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_UIConstruction_Buttons2" is not in camel caps format Open
class Quad_UIConstruction_Buttons2 extends Quad
- Exclude checks