Showing 12 of 35 total issues
Method parseColor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function parseColor($color)
{
$colorLower = strtolower($color);
if (isset(self::$namedColors[$colorLower])) {
return self::$namedColors[$colorLower];
Method renderStroke
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function renderStroke($image, array $params, $color, $strokeWidth)
{
imagesetthickness($image, $strokeWidth);
$x1 = $params['x1'];
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($x1 = null, $y1 = null, $x2 = null, $y2 = null, $text = null, $fontsize = null, $color = null, $fontfile = null)
Function getSerializableAttributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getSerializableAttributes()
{
$attrs = parent::getSerializableAttributes();
if ($this->root) {
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($x = null, $y = null, $text1 = null, $fontsize = null, $color = null, $fontfile = null)
Method calculateCubic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function calculateCubic($p0, $p1, $p2, $p3, $t)
Method cubic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function cubic($p0, $p1, $p2, $p3, $accuracy = 1)
Function parseCommandChain
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function parseCommandChain($id, array $args, array &$commands)
{
if (!isset(self::$commandLengths[$id])) {
// unknown command
return false;
- 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 applyAttributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function applyAttributes(SVGNode $node, \SimpleXMLElement $xml)
{
foreach ($xml->attributes() as $key => $value) {
if ($key === 'style') {
continue;
- 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
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return true;
Function approximate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function approximate(array $cmds)
{
$subpaths = array();
$posX = 0;
- 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"