Function divideSelectorsAndProperties
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private static function divideSelectorsAndProperties($csses)
{
$rets = array();
foreach ($csses as $type => $type_css)
- 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 divideEachProperties
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function divideEachProperties($each_properties)
{
$props = array();
foreach ($each_properties as $prop_and_val)
{
- 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 makeArray
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function makeArray($css)
{
// remove comments, import or so
$css = preg_replace('/\/\*.+?\*\//is', '', $css);
$css = preg_replace('/^@import.+?$/mis', '', $css);
- 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 divideEachProperties
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function divideEachProperties($each_properties)
{
$props = array();
foreach ($each_properties as $prop_and_val)
{
Method makeArray
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function makeArray($css)
{
// remove comments, import or so
$css = preg_replace('/\/\*.+?\*\//is', '', $css);
$css = preg_replace('/^@import.+?$/mis', '', $css);
Avoid using undefined variables such as '$suspicious_prop_and_vals' which will lead to PHP notices. Open
Model\Css::$suspicious_prop_and_vals[] = $prop_and_val;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$suspicious_val_prop' which will lead to PHP notices. Open
Model\Css::$suspicious_val_prop[] = array($prop_and_vals[0], $prop_and_vals[1]);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$suspicious_props' which will lead to PHP notices. Open
Model\Css::$suspicious_props[] = $prop_and_vals[0];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}