Showing 20 of 24 total issues
Tooltips
has 64 functions (exceeds 20 allowed). Consider refactoring. Open
class Tooltips implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
Scale
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Scale implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
LineDataSet
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class LineDataSet extends DataSet
{
/**
* @var bool|string
*/
Ticks
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class Ticks implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
RadarDataSet
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class RadarDataSet extends DataSet
{
/**
* @var bool
*/
File Tooltips.php
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Halfpastfour\PHPChartJS\Options;
use Halfpastfour\PHPChartJS\ArraySerializableInterface;
The class Scale has an overall complexity of 50 which is very high. The configured complexity threshold is 50. Open
abstract class Scale implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
- Exclude checks
The class Tooltips has an overall complexity of 65 which is very high. The configured complexity threshold is 50. Open
class Tooltips implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
- Exclude checks
Callbacks
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Callbacks implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
DataSet
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class DataSet implements ChartOwnedInterface, ArraySerializableInterface, JsonSerializableInterface
{
use ChartOwned;
use Delegate\ArraySerializable;
use Delegate\JsonSerializable;
GridLines
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class GridLines implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
use StringUtils;
use NumberUtils;
Line
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Line implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/** https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap */
File Scale.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Halfpastfour\PHPChartJS\Options;
use Halfpastfour\PHPChartJS\ArraySerializableInterface;
The class Scale has 47 public methods and attributes. Consider reducing the number of public items to less than 45. Open
abstract class Scale implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class Tooltips has 64 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Tooltips implements ArraySerializableInterface, JsonSerializable
{
use ArraySerializable;
/**
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Missing class import via use statement (line '32', column '23'). Open
throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist.");
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method render has a boolean flag argument $pretty, which is a certain sign of a Single Responsibility Principle violation. Open
public function render($pretty = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method setLineWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->lineWidth = is_null($lineWidth) ? null : intval($lineWidth);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method setColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->color = is_null($color) ? null : strval($color);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The 'getIntersect()' method which returns a boolean should be named 'is...()' or 'has...()' Open
public function getIntersect()
{
return $this->intersect;
}
- Read upRead up
- Exclude checks
BooleanGetMethodName
Since: 0.2
Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.
Example
class Foo {
/**
* @return boolean
*/
public function getFoo() {} // bad
/**
* @return bool
*/
public function isFoo(); // ok
/**
* @return boolean
*/
public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}