jidaikobo-shibata/a11yc

View on GitHub
classes/Model/CssFormat.php

Summary

Maintainability
C
7 hrs
Test Coverage

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)
Severity: Minor
Found in classes/Model/CssFormat.php - About 2 hrs to fix

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)
        {
Severity: Minor
Found in classes/Model/CssFormat.php - About 1 hr to fix

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);
Severity: Minor
Found in classes/Model/CssFormat.php - About 1 hr to fix

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)
        {
Severity: Minor
Found in classes/Model/CssFormat.php - About 1 hr to fix

    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);
    Severity: Minor
    Found in classes/Model/CssFormat.php - About 1 hr to fix

      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;
      Severity: Minor
      Found in classes/Model/CssFormat.php by phpmd

      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]);
      Severity: Minor
      Found in classes/Model/CssFormat.php by phpmd

      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];
      Severity: Minor
      Found in classes/Model/CssFormat.php by phpmd

      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

      There are no issues that match your filters.

      Category
      Status