Showing 203 of 203 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!$this->count) {
$this->minX = $this->maxX = $x;
$this->minY = $this->maxY = $y;
} else {
$this->minX = min($this->minX, $x);
- 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 126.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!$this->count) {
$this->minX = $this->maxX = $x;
$this->minY = $this->maxY = $y;
} else {
$this->minX = min($this->minX, $x);
- 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 126.
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
HighCharts
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class HighCharts extends BaseClass implements Renderer
{
public function isEmpty()
{
Method makeExpression
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeExpression(Parsed $parsed, &$binds, &$index) {
$statement = '';
foreach ($parsed->tokens as $token) {
if ($token instanceof Token) {
Method findOrCreateInstance
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function findOrCreateInstance($serviceClassName, $identifier, $idIsSettings = false) {
//var_dump('=-=-=-=-=-=-=-=-=-=-=-=-=-=',$serviceClassName, $identifier, $idIsSettings);
if ($identifier instanceof Closure) {
$identifier = self::resolveClosure($identifier);
Method varExportString
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function varExportString($string, $usePhpEol = true) {
static $specialChars = array(
"\r" => '\r',
"\n" => '\n',
"\t" => '\t',
Function parseLines
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function parseLines() {
$this->columns = new \stdClass();
$this->indexes = array();
$this->foreignKeys = 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
Function castField
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function castField($value, $columnFlags, $import = true)
{
if (!($columnFlags & self::NOT_NULL) && $value === null) {
return 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 backTrace
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function backTrace($skip = 0, $return = self::TRACE_HTML)
{
//if (!self::$isActive) {
// return '';
// }
- 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 apply
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply()
{
if (self::$enableStateCache && isset(self::$applied[$this->table->entityClassName])) {
if ($this->log) {
$this->log->push(Expression::create(
Method build
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build(Quoter $quoter = null) {
if ($this->binds) {
if ($quoter === null && $this->quoter !== null) {
$quoter = $this->quoter;
}
Function perform
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function perform(Migration $migration, $action = Migration::APPLY)
{
if ($action === Migration::SKIP) {
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 quote
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function quote($value)
{
if (null === $value) {
return 'NULL';
} elseif (is_int($value)) {
- 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 processToken
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function processToken()
{
$optionFound = null;
if (($optionName = $this->token->afterStarts(Runner::OPTION_NAME)) && isset($this->def->byName[$optionName])) {
$optionFound = $this->def->byName[$optionName];
- 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 read
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function read(Request $request, array $options)
{
$this->def = new PrepareDefinition($options);
$tokens = $request->server()->argv;
- 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 __construct
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($options)
{
$this->optionsArray = $options;
/** @var Option $hasVariadicArgument */
Method findSaved
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findSaved()
{
$table = $this->table();
$statement = self::statement();
$data = $this->toArray(true);
Method fetchAll
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetchAll($keyField = null, $valueField = null)
{
if (!$this->executed) {
$this->execute();
}
Method getByColumn
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getByColumn(Column $column)
{
$flags = $column->flags;
$typeString = $this->getBaseType($column);
Method parseLines
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseLines() {
$this->columns = new \stdClass();
$this->indexes = array();
$this->foreignKeys = array();