Showing 108 of 109 total issues
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$imgWidth,
$imgHeight,
PlacerInterface $placer,
FontMetrics $metrics,
$precise = false,
Method getFilterBuilder
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$minWordLength,
$maxWordLength,
$changeCase = null,
$noRemoveNumbers = false,
$noRemoveUnwanted = false,
Method drawText
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function drawText($x, $y, $text, $size, $color = '#000000', $angle = 0)
The class CommandsHelper has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13. Open
class CommandsHelper
{
protected $fontSizeBoosts = array('linear', 'dim', 'boost');
protected $paletteTypes = array('cycle', 'random');
protected $outputFormats = array('gif', 'jpeg', 'png');
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Method render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
CloudBuilder $cloudBuilder,
FontsFactory $factory,
PlacerInterface $placer = null,
$renderBoxes = false,
$renderMask = false
Method drawBox
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function drawBox($x, $y, $width, $height, $color = '#000000')
Method getBoxForText
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function getBoxForText($x, $y, $width, $height, $angle)
Method addWordToMask
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function addWordToMask($word, Box $place, $font, $size, $angle)
Function renderCloud
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function renderCloud()
{
/** @var \SixtyNine\Cloud\Model\CloudWord $word */
foreach ($this->cloud->getWords() as $word) {
- 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
The method getFilterBuilder has a boolean flag argument $noRemoveTrailing, which is a certain sign of a Single Responsibility Principle violation. Open
$noRemoveTrailing = 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 render has a boolean flag argument $renderBoxes, which is a certain sign of a Single Responsibility Principle violation. Open
$renderBoxes = 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 render has a boolean flag argument $renderMask, which is a certain sign of a Single Responsibility Principle violation. Open
$renderMask = 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 getFilterBuilder has a boolean flag argument $noRemoveUnwanted, which is a certain sign of a Single Responsibility Principle violation. Open
$noRemoveUnwanted = 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 create has a boolean flag argument $isFontPath, which is a certain sign of a Single Responsibility Principle violation. Open
public static function create($fonts, $isFontPath = true)
- 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 __construct has a boolean flag argument $precise, which is a certain sign of a Single Responsibility Principle violation. Open
$precise = 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
Missing class import via use statement (line '251', column '18'). Open
$d = new \DOMDocument;
- 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 __construct has a boolean flag argument $minLength, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($minLength = false, $maxLength = 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
Missing class import via use statement (line '252', column '21'). Open
$mock = new \DOMDocument;
- 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 getFilterBuilder has a boolean flag argument $noRemoveNumbers, which is a certain sign of a Single Responsibility Principle violation. Open
$noRemoveNumbers = 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 saveCloud has a boolean flag argument $pretty, which is a certain sign of a Single Responsibility Principle violation. Open
public function saveCloud(Cloud $cloud, $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) {
}
}