Showing 6,805 of 6,805 total issues
File config.inc.php
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* JPGraph - Community Edition
*/
Method _StrokeRegularRose
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _StrokeRegularRose($dblImg, $value, $scaling, $xc, $yc, $r, $ri)
{
// _StrokeRegularRose($dblImg,$xc,$yc,$r,$ri)
// Plot radial grid lines and remember the end position
// and the angle for later use when plotting the labels
Function StrokeLabel
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function StrokeLabel($label, $img, $xc, $yc, $a, $r)
{
// Default value
if ($this->ilabelposadj === 'auto') {
$this->ilabelposadj = 0.65;
- 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 Stroke
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($aOtherAxisScale, $aStrokeLabels = true)
{
if ($this->hide) {
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 _StrokeTTF
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _StrokeTTF($x, $y, $txt, $dir, $paragraph_align, &$aBoundingBox, $debug = false)
{
// Setup default inter line margin for paragraphs to be
// 3% of the font height.
$ConstLineSpacing = 0.03;
File HandDigits.php
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* JPGraph v4.0.3
*/
File LinePlot.php
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* JPGraph v4.0.3
*/
Method StrokeTitles
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function StrokeTitles()
{
$margin = 3;
if ($this->titlebackground) {
Function StrokeDays
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function StrokeDays($aYCoord, $getHeight = false)
{
$img = $this->iImg;
$daywidth = $this->GetDayWidth();
$xt = $img->left_margin + $this->iLabelWidth;
- 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
File Legend.php
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* JPGraph v4.0.3
*/
WindrosePlot
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class WindrosePlot
{
private $iAntiAlias = true;
private $iData = [];
public $iX = 0.5;
Identical blocks of code found in 2 locations. Consider refactoring. Open
public static function tryHexConversion($aColor)
{
if (is_array($aColor)) {
if (safe_count($aColor) == 3) {
if (is_numeric($aColor[0]) && is_numeric($aColor[1]) && is_numeric($aColor[2])) {
- 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 189.
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
public static function tryHexConversion($aColor)
{
if (is_array($aColor)) {
if (safe_count($aColor) == 3) {
if (is_numeric($aColor[0]) && is_numeric($aColor[1]) && is_numeric($aColor[2])) {
- 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 189.
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 StrokeFrameBackground
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function StrokeFrameBackground()
{
if ($this->background_image != '' && $this->background_cflag != '') {
Util\JpGraphError::RaiseL(25040); //('It is not possible to specify both a background image and a background country flag.');
}
Function Stroke
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($img, $xscale, $yscale)
{
$n = $this->numpoints;
if ($this->center) {
--$n;
- 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 IntAutoScale
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function IntAutoScale($img, $min, $max, $maxsteps, $majend = true)
{
// Make sure limits are integers
$min = floor($min);
$max = ceil($max);
- 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 DoDateAutoScale
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function DoDateAutoScale($aStartTime, $aEndTime, $aDensity = 0, $aAdjust = true)
{
// Format of array
// array ( Decision point, array( array( Major-scale-step-array ),
// array( Minor-scale-step-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
Method _StrokeFreeRose
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _StrokeFreeRose($dblImg, $value, $scaling, $xc, $yc, $r, $ri)
{
// Plot radial grid lines and remember the end position
// and the angle for later use when plotting the labels
if ($this->iType != WINDROSE_TYPEFREE) {
Function Stroke
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($aImg, $aX = null, $aY = null)
{
if ($aX !== null && $aY !== null) {
$this->iXPos = $aX;
$this->iYPos = $aY;
- 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 Stroke
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function Stroke($aImg, $aScale)
{
$factory = new Graph\RectPatternFactory();
$prect = $factory->Create($this->iPattern, $this->iPatternColor);
$prect->SetDensity($this->iPatternDensity);