efureev/u.php

View on GitHub
src/uColor.php

Summary

Maintainability
A
0 mins
Test Coverage

The method hex2RGB has a boolean flag argument $returnAsString, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function hex2RGB($hexStr, $returnAsString = false, $separator = ',')
Severity: Minor
Found in src/uColor.php by phpmd

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

class uColor
{

    /**
     * Convert a hexa decimal color code to its RGB equivalent
Severity: Minor
Found in src/uColor.php by phpmd

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

}
Severity: Minor
Found in src/uColor.php by phpcodesniffer

Line exceeds 120 characters; contains 127 characters
Open

        return $returnAsString ? implode($separator, $rgbArray) : $rgbArray; // returns the rgb string or the associative array
Severity: Minor
Found in src/uColor.php by phpcodesniffer

Class name "uColor" is not in camel caps format
Open

class uColor
Severity: Minor
Found in src/uColor.php by phpcodesniffer

There are no issues that match your filters.

Category
Status