Showing 6,805 of 6,805 total issues
Function CheckCSIMCache
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function CheckCSIMCache($aCacheName, $aTimeOut = 60)
{
global $_SERVER;
if ($aCacheName == 'auto') {
- 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 StrokeBands
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function StrokeBands($aDepth, $aCSIM)
{
// Stroke bands
if ($this->bands != null && !$aCSIM) {
for ($i = 0; $i < safe_count($this->bands); ++$i) {
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($aImg, $aXLeft, $aYTop, $aXRight, $aYBottom, $aUseTextHeight = false)
{
if (!$this->iShow) {
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($adj < 1) {
$m = ($adj - 1.0) * max(255, max($r, max($g, $b)));
return [max(0, $r + $m), max(0, $g + $m), max(0, $b + $m), $alpha];
}
- 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 112.
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 ($adj < 1) {
$m = ($adj - 1.0) * max(255, max($r, max($g, $b)));
return [max(0, $r + $m), max(0, $g + $m), max(0, $b + $m), $alpha];
}
- 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 112.
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 Add3DSliceToCSIM
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function Add3DSliceToCSIM($i, $xc, $yc, $height, $width, $thick, $sa, $ea)
{
//Slice number, ellipse centre (x,y), height, width, start angle, end angle
$sa *= M_PI / 180;
Method StrokeFullSliceFrame
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function StrokeFullSliceFrame($img, $xc, $yc, $sa, $ea, $w, $h, $z, $edgecolor, $exploderadius, $fulledge)
{
$step = 0.02;
if ($exploderadius > 0) {
Method CopyMerge
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function CopyMerge($fromImg, $toX, $toY, $fromX, $fromY, $toWidth, $toHeight, $fromWidth = -1, $fromHeight = -1, $aMix = 100)
{
if ($aMix == 100) {
$this->CopyCanvasH(
$this->img,
Method GetBBoxTTF
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function GetBBoxTTF($aTxt, $aAngle = 0)
{
// Normalize the bounding box to become a minimum
// enscribing rectangle
Method LoadBkgImage
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function LoadBkgImage($aImgFormat = '', $aFile = '', $aImgStr = '')
{
if ($aImgStr != '') {
return Image::CreateFromString($aImgStr);
}
Method StrokeBoxedText2
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
$x,
$y,
$txt,
$dir = 0,
$fcolor = 'white',
Method StrokeBoxedText
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
$x,
$y,
$txt,
$dir = 0,
$fcolor = 'white',
The class Ticks has 22 fields. Consider redesigning Ticks to keep the number of fields under 15. Open
class Ticks
{
public $label_formatstr = ''; // C-style format string to use for labels
public $label_formfunc = '';
public $label_dateformatstr = '';
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class WindrosePlotScale has 20 fields. Consider redesigning WindrosePlotScale to keep the number of fields under 15. Open
class WindrosePlotScale
{
private $iMax;
private $iDelta = 5;
private $iNumCirc = 3;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class Image has 42 fields. Consider redesigning Image to keep the number of fields under 15. Open
class Image
{
public $img;
public $rgb;
public $img_format;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class ImgData_Balls has 17 fields. Consider redesigning ImgData_Balls to keep the number of fields under 15. Open
class ImgData_Balls extends ImgData
{
protected $name = 'Round Balls';
protected $an = [MARK_IMG_LBALL => 'imgdata_large',
MARK_IMG_MBALL => 'imgdata_small',
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class AxisPrototype has 29 fields. Consider redesigning AxisPrototype to keep the number of fields under 15. Open
class AxisPrototype
{
public $scale;
public $img;
public $hide = false;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class GanttActivityInfo has 18 fields. Consider redesigning GanttActivityInfo to keep the number of fields under 15. Open
class GanttActivityInfo
{
public $iShow = true;
public $iLeftColMargin = 4;
public $iRightColMargin = 1;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class GanttScale has 27 fields. Consider redesigning GanttScale to keep the number of fields under 15. Open
class GanttScale
{
public $minute;
public $hour;
public $day;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The class Graph has 120 fields. Consider redesigning Graph to keep the number of fields under 15. Open
class Graph
{
public $gDateLocale;
public $gJpgDateLocale;
public $cache; // Cache object (singleton)
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}