src/uColor.php
The method hex2RGB has a boolean flag argument $returnAsString, which is a certain sign of a Single Responsibility Principle violation. Open
Open
public static function hex2RGB($hexStr, $returnAsString = false, $separator = ',')
- 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 class uColor is not named in CamelCase. Open
Open
class uColor
{
/**
* Convert a hexa decimal color code to its RGB equivalent
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
The closing brace for the class must go on the next line after the body Open
Open
}
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
Open
return $returnAsString ? implode($separator, $rgbArray) : $rgbArray; // returns the rgb string or the associative array
- Exclude checks
Class name "uColor" is not in camel caps format Open
Open
class uColor
- Exclude checks