YetiForceCompany/YetiForcePDF

View on GitHub
lib/Style/Normalizer/Normalizer.php

Summary

Maintainability
C
7 hrs
Test Coverage

Method getNumberValues has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getNumberValues($ruleValue, bool $isFont = false)
    {
        if ($ruleValue instanceof NumericValue) {
            return $ruleValue;
        }
Severity: Minor
Found in lib/Style/Normalizer/Normalizer.php - About 1 hr to fix

    Function getNumberValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getNumberValues($ruleValue, bool $isFont = false)
        {
            if ($ruleValue instanceof NumericValue) {
                return $ruleValue;
            }
    Severity: Minor
    Found in lib/Style/Normalizer/Normalizer.php - About 25 mins 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

    Reduce the number of returns of this function 4, down to the maximum allowed 3.
    Open

        public function normalizeMultiValues(array $ruleNames, $ruleValue): array

    Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

    Noncompliant Code Example

    With the default threshold of 3:

    function myFunction(){ // Noncompliant as there are 4 return statements
      if (condition1) {
        return true;
      } else {
        if (condition2) {
          return false;
        } else {
          return true;
        }
      }
      return false;
    }
    

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

        public function getNumberValues($ruleValue, bool $isFont = false)
    Severity: Minor
    Found in lib/Style/Normalizer/Normalizer.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Rename "$normalized" which has the same name as the field declared at line 31.
    Open

            $normalized = [];

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Rename "$normalized" which has the same name as the field declared at line 31.
    Open

            $normalized = [];

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Rename "$normalized" which has the same name as the field declared at line 31.
    Open

            $normalized = [];

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Rename "$normalized" which has the same name as the field declared at line 31.
    Open

            $normalized = [];

    Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

    Noncompliant Code Example

    class Foo {
      public $myField;
    
      public function doSomething() {
        $myField = 0;
        ...
      }
    }
    

    See

    Add a "case default" clause to this "switch" statement.
    Open

            switch (\count($numberValues)) {
    Severity: Critical
    Found in lib/Style/Normalizer/Normalizer.php by sonar-php

    The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

    Noncompliant Code Example

    switch ($param) {  //missing default clause
      case 0:
        do_something();
        break;
      case 1:
        do_something_else();
        break;
    }
    
    switch ($param) {
      default: // default clause should be the last one
        error();
        break;
      case 0:
        do_something();
        break;
      case 1:
        do_something_else();
        break;
    }
    

    Compliant Solution

    switch ($param) {
      case 0:
        do_something();
        break;
      case 1:
        do_something_else();
        break;
      default:
        error();
        break;
    }
    

    See

    • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
    • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
    • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
    • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
    • MISRA C:2012, 16.1 - All switch statements shall be well-formed
    • MISRA C:2012, 16.4 - Every switch statement shall have a default label
    • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
    • MITRE, CWE-478 - Missing Default Case in Switch Statement
    • CERT, MSC01-C. - Strive for logical completeness
    • CERT, MSC01-CPP. - Strive for logical completeness

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        protected function threeValues(array $ruleNames, array $numberValues)
        {
            $normalized = [];
            $normalized[$ruleNames[0]] = $numberValues[0];
            $normalized[$ruleNames[1]] = $numberValues[1];
    Severity: Major
    Found in lib/Style/Normalizer/Normalizer.php and 3 other locations - About 55 mins to fix
    lib/Style/Normalizer/Normalizer.php on lines 184..192
    lib/Style/Normalizer/Normalizer.php on lines 202..210
    lib/Style/Normalizer/Normalizer.php on lines 238..246

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 99.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        protected function fourValues(array $ruleNames, array $numberValues)
        {
            $normalized = [];
            $normalized[$ruleNames[0]] = $numberValues[0];
            $normalized[$ruleNames[1]] = $numberValues[1];
    Severity: Major
    Found in lib/Style/Normalizer/Normalizer.php and 3 other locations - About 55 mins to fix
    lib/Style/Normalizer/Normalizer.php on lines 184..192
    lib/Style/Normalizer/Normalizer.php on lines 202..210
    lib/Style/Normalizer/Normalizer.php on lines 220..228

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 99.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        protected function oneValue(array $ruleNames, array $numberValues)
        {
            $normalized = [];
            $normalized[$ruleNames[0]] = $numberValues[0];
            $normalized[$ruleNames[1]] = $numberValues[0];
    Severity: Major
    Found in lib/Style/Normalizer/Normalizer.php and 3 other locations - About 55 mins to fix
    lib/Style/Normalizer/Normalizer.php on lines 202..210
    lib/Style/Normalizer/Normalizer.php on lines 220..228
    lib/Style/Normalizer/Normalizer.php on lines 238..246

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 99.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        protected function twoValues(array $ruleNames, array $numberValues)
        {
            $normalized = [];
            $normalized[$ruleNames[0]] = $numberValues[0];
            $normalized[$ruleNames[1]] = $numberValues[1];
    Severity: Major
    Found in lib/Style/Normalizer/Normalizer.php and 3 other locations - About 55 mins to fix
    lib/Style/Normalizer/Normalizer.php on lines 184..192
    lib/Style/Normalizer/Normalizer.php on lines 220..228
    lib/Style/Normalizer/Normalizer.php on lines 238..246

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 99.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if ($matchesCount >= 2) {
                $multi[] = (new NumericValue())
                    ->setUnit($matches[1][3] ?? $originalUnit)
                    ->setValue($matches[1][2])
                    ->setOriginal($matches[1][2] . ($matches[1][3] ?? $originalUnit))
    Severity: Minor
    Found in lib/Style/Normalizer/Normalizer.php and 1 other location - About 55 mins to fix
    lib/Style/Normalizer/Normalizer.php on lines 108..115

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if ($matchesCount >= 3) {
                $multi[] = (new NumericValue())
                    ->setUnit($matches[2][3] ?? $originalUnit)
                    ->setValue($matches[2][2])
                    ->setOriginal($matches[2][2] . ($matches[2][3] ?? $originalUnit))
    Severity: Minor
    Found in lib/Style/Normalizer/Normalizer.php and 1 other location - About 55 mins to fix
    lib/Style/Normalizer/Normalizer.php on lines 100..107

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $ucRuleName = str_replace('-', '', ucwords($ruleName, '-'));

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $multi = [

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->convert($this->style);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[2]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function twoValues(array $ruleNames, array $numberValues)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[1]] = $numberValues[1];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $style;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Regex used to parse numeric values.

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $ruleName

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get number value from style.

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($ruleValue instanceof NumericValue) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $originalSize = $matches[0][2];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (isset($matches[0][3])) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setOriginal($matches[3][2] . ($matches[3][3] ?? $originalUnit))

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setOriginal($matches[1][2] . ($matches[1][3] ?? $originalUnit))

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setIsFont($isFont)

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setUnit($matches[2][3] ?? $originalUnit)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $matches = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

            preg_match_all(static::$numericRegex, $value, $matches, PREG_SET_ORDER);

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return [$ruleName => $ruleValue];

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $numberValues

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[2]] = $numberValues[2];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Four values.

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[1]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[3]] = $numberValues[3];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Two values.

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    return $this->twoValues($ruleNames, $numberValues);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    return $this->fourValues($ruleNames, $numberValues);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $numberValues

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    return $this->threeValues($ruleNames, $numberValues);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param \YetiForcePDF\Style\Style $style

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalizerClassName = "YetiForcePDF\\Style\\Normalizer\\$ucRuleName";

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                (new NumericValue())

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var string

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setOriginal($originalSize . $originalUnit)

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setOriginal($matches[2][2] . ($matches[2][3] ?? $originalUnit))

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setValue($matches[3][2])

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Set style.

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function oneValue(array $ruleNames, array $numberValues)

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $normalized;

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[0]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->convert($this->style),

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string   $ruleValue

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (4 === $matchesCount) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $defaultUnit

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $numberValues

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function fourValues(array $ruleNames, array $numberValues)

    Spaces must be used to indent lines; tabs are not allowed
    Open

                case 2:

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var Style

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return $this

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function getNumberValues($ruleValue, bool $isFont = false)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $numberValues

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[3]] = $numberValues[1];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[1]] = $numberValues[1];

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function normalizeMultiValues(array $ruleNames, $ruleValue): array

    Spaces must be used to indent lines; tabs are not allowed
    Open

                case 4:

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function setStyle(Style $style)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $this;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get normalizer class name.

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return $normalizerClassName;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param NumericValue|string $ruleValue

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (!$matches) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $matches = [['0', '0', '0']];

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setIsFont($isFont)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($matchesCount >= 2) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $multi[] = (new NumericValue())

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $unit;

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (isset($matches[0][2])) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * One value.

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string[] $ruleNames ['margin-top','margin-right','margin-bottom','margin-left']

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    return $this->oneValue($ruleNames, $numberValues);

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (class_exists($normalizerClassName)) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            preg_match_all(static::$numericRegex, $ruleValue, $matches, PREG_SET_ORDER);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $originalUnit = 'em';

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setValue($matches[2][2])

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setUnit($matches[3][3] ?? $originalUnit)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $multi;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Is numeric value.

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[0]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[3]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $ruleNames

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return $ruleValue;

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $matchesCount = \count($matches);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setValue($matches[1][2])

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected $normalized;

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setIsFont($isFont)

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $multi[] = (new NumericValue())

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $matches = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->convert($this->style);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $value       value from css 12px for example

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if (isset($matches[0][3])) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $ruleName

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $normalized;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param bool                $isFont

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[2]] = $numberValues[2];

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $originalUnit = $matches[0][3];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $normalized;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *                            return array

    Spaces must be used to indent lines; tabs are not allowed
    Open

                return $matches[0][2];

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function normalize($ruleValue, string $ruleName = ''): array

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function getNormalizerClassName(string $ruleName)

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setUnit($originalUnit)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return $normalized;

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($matchesCount >= 3) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $ruleNames

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            preg_match_all(static::$numericRegex, $value, $matches, PREG_SET_ORDER);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[2]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[0]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[0]] = $numberValues[0];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Normalize multi number values.

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $numberValues = $this->getNumberValues($ruleValue);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                case 3:

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return string[]

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $unit = $defaultUnit;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function getNumericValue(string $value)

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @var array|null normalized value

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $ruleNames

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $this->style = $style;

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Three values.

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setValue($originalSize)

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $multi[] = (new NumericValue())

    Spaces must be used to indent lines; tabs are not allowed
    Open

            switch (\count($numberValues)) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->convert($this->style);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Get numeric unit from css value.

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[1]] = $numberValues[1];

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static $numericRegex = '/(([0-9.?]+)([a-z%]+)?\s?)/ui';

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setIsFont($isFont)

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return 'YetiForcePDF\\Style\\Normalizer\\Normalizer';

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public static function getNumericUnit(string $value, string $defaultUnit): string

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $value

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    ->setUnit($matches[1][3] ?? $originalUnit)

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $unit = $matches[0][3];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return bool|string

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param mixed  $ruleValue

    Spaces must be used to indent lines; tabs are not allowed
    Open

            return false;

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

        protected function threeValues(array $ruleNames, array $numberValues)

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Normalize css rule.

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $normalized[$ruleNames[3]] = $numberValues[1];

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param array $ruleNames

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @return array

    Spaces must be used to indent lines; tabs are not allowed
    Open

                case 1:

    There are no issues that match your filters.

    Category
    Status