lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php

Summary

Maintainability
F
1 wk
Test Coverage

Function clean has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
Open

    public function clean($config)
    {
        $css = isset($config['css']) ? $config['css'] : '';
        $url = isset($config['url']) ? $config['url'] : '';
        $compress = isset($config['compress']) ? $config['compress'] : '';
Severity: Minor
Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 2 days 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

File CSS3Maximizer.php has 658 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*

    CSS3Maximizer : v0.1 : mudcu.be
Severity: Major
Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 1 day to fix

    Function ParseCSS has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        private function ParseCSS($str)
        {
            $css = [];
            $str = preg_replace("/\/\*(.*)?\*\//Usi", '', $str);
            $parts = explode('}', $str);
    Severity: Minor
    Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 7 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

    Method clean has 169 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function clean($config)
        {
            $css = isset($config['css']) ? $config['css'] : '';
            $url = isset($config['url']) ? $config['url'] : '';
            $compress = isset($config['compress']) ? $config['compress'] : '';
    Severity: Major
    Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 6 hrs to fix

      Function Webkit_to_W3C_Gradient has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          private function Webkit_to_W3C_Gradient($value)
          {
      
              ///--- webkit supports out-of-order color-stops (others fail)...
      
      
      Severity: Minor
      Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 3 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

      The class CSS3Maximizer has an overall complexity of 121 which is very high. The configured complexity threshold is 50.
      Open

      class CSS3Maximizer
      {
          private $ColorSpace;
          private $code;
      
      

      Function parseColors has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parseColors($colors, $doFallback = false)
          {
              $fallback = [];
              foreach ($colors as $key => $value) {
                  $tmp = str_replace('  ', ' ', trim($value));
      Severity: Minor
      Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 3 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

      Method Webkit_to_W3C_Gradient has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function Webkit_to_W3C_Gradient($value)
          {
      
              ///--- webkit supports out-of-order color-stops (others fail)...
      
      
      Severity: Major
      Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 2 hrs to fix

        Method ParseCSS has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function ParseCSS($str)
            {
                $css = [];
                $str = preg_replace("/\/\*(.*)?\*\//Usi", '', $str);
                $parts = explode('}', $str);
        Severity: Major
        Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 2 hrs to fix

          Function W3C_to_Webkit_Gradient has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              private function W3C_to_Webkit_Gradient($value)
              {
                  $start = array_shift($value);
                  switch ($start) {
                      case 'top':
          Severity: Minor
          Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.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 splitGradient has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              private function splitGradient($value)
              {
                  $values = [];
                  while (strlen($value)) {
                      $ishex = strpos($value, ',');
          Severity: Minor
          Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.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

          Method parseColor has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function parseColor($color)
              {
                  $color = trim($color);
                  if (strpos($color, '(')) { // rgb, rgba, hsl or hsla
                      $first = strpos($color, '(');
          Severity: Minor
          Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 1 hr to fix

            Method parseColors has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function parseColors($colors, $doFallback = false)
                {
                    $fallback = [];
                    foreach ($colors as $key => $value) {
                        $tmp = str_replace('  ', ' ', trim($value));
            Severity: Minor
            Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 1 hr to fix

              Method W3C_to_Webkit_Gradient has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function W3C_to_Webkit_Gradient($value)
                  {
                      $start = array_shift($value);
                      switch ($start) {
                          case 'top':
              Severity: Minor
              Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 1 hr to fix

                Function splitByColor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function splitByColor($value)
                    {
                        $values = [];
                        while (strlen($value)) {
                            $ishex = strpos($value, '#');
                Severity: Minor
                Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.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 parseColor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function parseColor($color)
                    {
                        $color = trim($color);
                        if (strpos($color, '(')) { // rgb, rgba, hsl or hsla
                            $first = strpos($color, '(');
                Severity: Minor
                Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.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 splitGradient has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function splitGradient($value)
                    {
                        $values = [];
                        while (strlen($value)) {
                            $ishex = strpos($value, ',');
                Severity: Minor
                Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 1 hr to fix

                  Function parseGradient has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function parseGradient($property, $value)
                      {
                          $type = substr($value, 0, strpos($value, '('));
                          $tmp = substr($value, strpos($value, '(') + 1, -1);
                          $values = [];
                  Severity: Minor
                  Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.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

                  Avoid too many return statements within this method.
                  Open

                                  return [];
                  Severity: Major
                  Found in lib/Ajde/Document/Processor/Css/lib/maximizer/CSS3Maximizer.php - About 30 mins to fix

                    The method ParseCSS() has an NPath complexity of 302. The configured NPath complexity threshold is 200.
                    Open

                        private function ParseCSS($str)
                        {
                            $css = [];
                            $str = preg_replace("/\/\*(.*)?\*\//Usi", '', $str);
                            $parts = explode('}', $str);

                    NPathComplexity

                    Since: 0.1

                    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                    Example

                    class Foo {
                        function bar() {
                            // lots of complicated code
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#npathcomplexity

                    The method clean() has 177 lines of code. Current threshold is set to 100. Avoid really long methods.
                    Open

                        public function clean($config)
                        {
                            $css = isset($config['css']) ? $config['css'] : '';
                            $url = isset($config['url']) ? $config['url'] : '';
                            $compress = isset($config['compress']) ? $config['compress'] : '';

                    The method clean() has an NPath complexity of 42812352. The configured NPath complexity threshold is 200.
                    Open

                        public function clean($config)
                        {
                            $css = isset($config['css']) ? $config['css'] : '';
                            $url = isset($config['url']) ? $config['url'] : '';
                            $compress = isset($config['compress']) ? $config['compress'] : '';

                    NPathComplexity

                    Since: 0.1

                    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                    Example

                    class Foo {
                        function bar() {
                            // lots of complicated code
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#npathcomplexity

                    The method parseColors() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                    Open

                        private function parseColors($colors, $doFallback = false)
                        {
                            $fallback = [];
                            foreach ($colors as $key => $value) {
                                $tmp = str_replace('  ', ' ', trim($value));

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method Webkit_to_W3C_Gradient() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                    Open

                        private function Webkit_to_W3C_Gradient($value)
                        {
                    
                            ///--- webkit supports out-of-order color-stops (others fail)...
                    
                    

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method clean() has a Cyclomatic Complexity of 45. The configured cyclomatic complexity threshold is 10.
                    Open

                        public function clean($config)
                        {
                            $css = isset($config['css']) ? $config['css'] : '';
                            $url = isset($config['url']) ? $config['url'] : '';
                            $compress = isset($config['compress']) ? $config['compress'] : '';

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    The method ParseCSS() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                    Open

                        private function ParseCSS($str)
                        {
                            $css = [];
                            $str = preg_replace("/\/\*(.*)?\*\//Usi", '', $str);
                            $parts = explode('}', $str);

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

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

                        private function parseColors($colors, $doFallback = false)

                    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

                    Missing class import via use statement (line '101', column '33').
                    Open

                            $this->ColorSpace = new ColorSpace();

                    MissingImport

                    Since: 2.7.0

                    Importing all external classes in a file through use statements makes them clearly visible.

                    Example

                    function make() {
                        return new \stdClass();
                    }

                    Source http://phpmd.org/rules/cleancode.html#MissingImport

                    The method parseColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else { // no fallback necessary
                                return $colors;
                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                return [
                                    'hex' => $color,
                                ];
                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method splitGradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else { // split by comma [rgb, rgba, hsl, hsla]
                                    $isother = strpos($value, ')');
                                    if ($isother === false) {
                                        array_push($values, $value);
                                        $value = '';

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else { // split color from properties [rgb, rgba, hsl or hsla]
                                    $pos = substr($tmp, 0, $pos);
                                    $backpos = strrpos($pos, ' ');
                                    if ($backpos === false) {
                                        $backpos = -1;

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        $fallback[$key] = $first.$color['hex'];
                                        $colors[$key] = $first.$color['hex'];
                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method splitByColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else { // split by comma [rgb, rgba, hsl, hsla]
                                    array_push($values, substr($value, 0, $isother + 1));
                                    $value = trim(substr($value, $isother + 2));
                                }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method Webkit_to_W3C_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    if (!$aIsSame && !$bIsSame) { // convert to angle
                                        $p1 = array_merge(
                                            ['x' => 0, 'y' => 0],
                                            $this->Webkit_Gradient_Position($start[0]),

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                                    } else {
                                                        $alias[$key] = $value;
                                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseGradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    if ($key == 'filter') {
                                        $color = $value['microsoft'];
                                        $values[$key] = "filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='{$color[0]}', EndColorStr='{$color[1]}')";
                                    } else {

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseGradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        $values[$key] = $key.'('.$value['w3c'].')';
                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method splitGradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        $stop = substr($value, 0, $isother + 1);
                                        if (substr_count($stop, '(') === 2) {
                                            $isother += 1;
                                            $stop = $stop.')';

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        if (in_array($type, $this->defColorProperties)) {
                                            $doFallback = in_array($type, $this->defColorFallback);
                                            $value = $this->parseColors($this->splitByColor($value), $doFallback);
                                        }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                            } else { // background-color as "background"
                                                $doFallback = in_array($type, $this->defColorFallback);
                                                $value = $this->parseColors($this->splitByColor($value), $doFallback);
                                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                                } else {
                                                    if ($key == '-moz-transition-property') {
                                                        $tmp = $value;
                                                        if ($tmp == 'transform') {
                                                            $tmp = '-moz-transform';

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else { // multiple values
                                        foreach ($value as $key => $tmp) {
                                            if ($compress) {
                                                $tmp = str_replace(', ', ',', $tmp);
                                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method Webkit_to_W3C_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                if (!$aIsSame && $bIsSame) {
                                    $start = 'left';
                                } else {
                                    if (!$aIsSame && !$bIsSame) { // convert to angle

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method splitByColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else { // split by comma [hex]
                                        array_push($values, substr($value, 0, $comma));
                                        $value = trim(substr($value, $comma + 1));
                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    if ($color['rgba']) {
                                        $colors[$key] = $first.$color['rgba'];
                                    } else { // everything is supported in hex!
                                        $colors[$key] = $first.$color['hex'];

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else { // requires alpha
                                    $r = max(0, min(255, round($color[R])));
                                    $g = max(0, min(255, round($color[G])));
                                    $b = max(0, min(255, round($color[B])));
                    
                    

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                            } else { // direct conversion of vender variants
                                                $cssText .= $tab.$key.":{$space}".$tmp.";{$newline}";
                                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                        } else {
                                            if ($typeof == 'array' && $property['value'][$type]) {
                                                if ($type === 'filter') {
                                                    $value = [
                                                        'filter' => $type.': '.$value,

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseColors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else { // everything is supported in hex!
                                        $colors[$key] = $first.$color['hex'];
                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method parseGradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else { // convert from other to webkit
                                $value = $this->W3C_to_Webkit_Gradient($this->splitGradient($tmp));
                                $value['w3c'] = $tmp;
                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                $this->code = $css;
                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method Webkit_to_W3C_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        $key = explode(',', $key, 2);
                                        $position = $key[0];
                                        if (!strpos($position, '%')) {
                                            $position = round($position * 100).'%';

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                            } else {
                                            }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                                } else {
                                                    $cssText .= $tab.$type.":{$space}".$tmp.";{$newline}";
                                                }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method Webkit_to_W3C_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    if ($type == 'to') {
                                        $position = '100%';
                                        $color = substr($key, 0, -1);
                                    } else {

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method W3C_to_Webkit_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else {
                                        array_push($values, "color-stop({$position}, {$color})");
                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method ParseCSS uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                        } else {
                                            $css[$id[0]] .= $part."}\r";
                                            continue;
                                        }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                        } else {
                                            if (strpos($value, 'gradient') !== false) { // background-gradient
                                                $value = $this->parseGradient($type, $value);
                                            } else { // background-color as "background"
                                                $doFallback = in_array($type, $this->defColorFallback);

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method W3C_to_Webkit_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    $color = $color['hex'];
                                }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method W3C_to_Webkit_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    if ($n === $count) {
                                        $last = $color;
                                        array_push($values, "to({$color})");
                                    } else {

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method clean uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    $cssText .= $cssID.$space.'{'.$newline;
                                    $cssText .= $content1;
                                    $cssText .= '}'.$newline;
                                }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method Webkit_to_W3C_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                    } else { // is "left"
                                        $start = 'left';
                                    }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method Webkit_to_W3C_Gradient uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    array_push($values, $color['hex'].' '.$position);
                                }

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    Avoid unused parameters such as '$property'.
                    Open

                        private function parseGradient($property, $value)

                    UnusedFormalParameter

                    Since: 0.2

                    Avoid passing parameters to methods or constructors and then not using those parameters.

                    Example

                    class Foo
                    {
                        private function bar($howdy)
                        {
                            // $howdy is not used
                        }
                    }

                    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                    TODO found
                    Open

                        TODO

                    Avoid excessively long variable names like $defGradientProperties. Keep variable name length under 20.
                    Open

                        private $defGradientProperties = [
                            'background',
                            'background-image',
                        ];

                    LongVariable

                    Since: 0.2

                    Detects when a field, formal or local variable is declared with a long name.

                    Example

                    class Something {
                        protected $reallyLongIntName = -3; // VIOLATION - Field
                        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                            $otherReallyLongName = -5; // VIOLATION - Local
                            for ($interestingIntIndex = 0; // VIOLATION - For
                                 $interestingIntIndex < 10;
                                 $interestingIntIndex++ ) {
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#longvariable

                    Avoid variables with short names like $b. Configured minimum length is 3.
                    Open

                                    $b = max(0, min(255, round($color[B])));

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $dy. Configured minimum length is 3.
                    Open

                                        $dy = $p2[y] - $p1[y];

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $y. Configured minimum length is 3.
                    Open

                                    $y = round(sin($start) * 100);

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $r. Configured minimum length is 3.
                    Open

                                    $r = max(0, min(255, round($color[R])));

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $id. Configured minimum length is 3.
                    Open

                                            $css[$id[0]] .= "}\r";

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $g. Configured minimum length is 3.
                    Open

                                    $g = max(0, min(255, round($color[G])));

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $dx. Configured minimum length is 3.
                    Open

                                        $dx = $p2[x] - $p1[x];

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $p1. Configured minimum length is 3.
                    Open

                                        $p1 = array_merge(

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $x. Configured minimum length is 3.
                    Open

                                    $x = round(cos($start) * 100);

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    Avoid variables with short names like $p2. Configured minimum length is 3.
                    Open

                                        $p2 = array_merge(

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

                    Source https://phpmd.org/rules/naming.html#shortvariable

                    The method Webkit_Gradient_Position is not named in camelCase.
                    Open

                        private function Webkit_Gradient_Position($value)
                        {
                            switch ($value) {
                                case 'top':
                                    return ['y' => -1];

                    CamelCaseMethodName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name methods.

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method Webkit_to_W3C_Gradient is not named in camelCase.
                    Open

                        private function Webkit_to_W3C_Gradient($value)
                        {
                    
                            ///--- webkit supports out-of-order color-stops (others fail)...
                    
                    

                    CamelCaseMethodName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name methods.

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method ParseCSS is not named in camelCase.
                    Open

                        private function ParseCSS($str)
                        {
                            $css = [];
                            $str = preg_replace("/\/\*(.*)?\*\//Usi", '', $str);
                            $parts = explode('}', $str);

                    CamelCaseMethodName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name methods.

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method W3C_to_Webkit_Gradient is not named in camelCase.
                    Open

                        private function W3C_to_Webkit_Gradient($value)
                        {
                            $start = array_shift($value);
                            switch ($start) {
                                case 'top':

                    CamelCaseMethodName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name methods.

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    There are no issues that match your filters.

                    Category
                    Status