YetiForceCompany/YetiForceCRM

View on GitHub
app/Integrations/Magento/Synchronizer/Maps/Base.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Function getFieldValue has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFieldValue(string $magentoFieldName, ?string $crmFieldName = null)
    {
        $parsedFieldName = $crmFieldName ?? $this->getFieldNameCrm($magentoFieldName);
        $methodName = 'getCrm' . \ucfirst($parsedFieldName);
        $fieldLevels = explode('|', $magentoFieldName);
Severity: Minor
Found in app/Integrations/Magento/Synchronizer/Maps/Base.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

Function getAddressFieldValue has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)
    {
        $methodName = 'getCrm' . \ucfirst($fieldNameCrm);
        if (!empty($fieldParsed = $this->getAddressDataByType($type))) {
            if (\method_exists($this, $methodName)) {
Severity: Minor
Found in app/Integrations/Magento/Synchronizer/Maps/Base.php - About 5 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 Base has an overall complexity of 67 which is very high. The configured complexity threshold is 50.
Open

abstract class Base
{
    /**
     * Map module name.
     *

File Base.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Abstract base map file.
 *
Severity: Minor
Found in app/Integrations/Magento/Synchronizer/Maps/Base.php - About 2 hrs to fix

    Method getFieldValue has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getFieldValue(string $magentoFieldName, ?string $crmFieldName = null)
        {
            $parsedFieldName = $crmFieldName ?? $this->getFieldNameCrm($magentoFieldName);
            $methodName = 'getCrm' . \ucfirst($parsedFieldName);
            $fieldLevels = explode('|', $magentoFieldName);
    Severity: Major
    Found in app/Integrations/Magento/Synchronizer/Maps/Base.php - About 2 hrs to fix

      Method getAddressFieldValue has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)
          {
              $methodName = 'getCrm' . \ucfirst($fieldNameCrm);
              if (!empty($fieldParsed = $this->getAddressDataByType($type))) {
                  if (\method_exists($this, $methodName)) {
      Severity: Minor
      Found in app/Integrations/Magento/Synchronizer/Maps/Base.php - About 1 hr to fix

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

            public function getCustomAttributeValue(string $name)
            {
                $value = '';
                $customAttributes = $this->data['custom_attributes'];
                if (!empty($customAttributes)) {
        Severity: Minor
        Found in app/Integrations/Magento/Synchronizer/Maps/Base.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

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

            public function parsePhone(string $fieldName, array $parsedData): array
            {
                if (\App\Config::main('phoneFieldAdvancedVerification', false)) {
                    $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
                    try {
        Severity: Minor
        Found in app/Integrations/Magento/Synchronizer/Maps/Base.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

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

            public function getFieldValue(string $magentoFieldName, ?string $crmFieldName = null)
            {
                $parsedFieldName = $crmFieldName ?? $this->getFieldNameCrm($magentoFieldName);
                $methodName = 'getCrm' . \ucfirst($parsedFieldName);
                $fieldLevels = explode('|', $magentoFieldName);

        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 getAddressFieldValue() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
        Open

            public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)
            {
                $methodName = 'getCrm' . \ucfirst($fieldNameCrm);
                if (!empty($fieldParsed = $this->getAddressDataByType($type))) {
                    if (\method_exists($this, $methodName)) {

        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

        Refactor this function to reduce its Cognitive Complexity from 38 to the 15 allowed.
        Open

            public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)

        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

        See

        Refactor this function to reduce its Cognitive Complexity from 48 to the 15 allowed.
        Open

            public function getFieldValue(string $magentoFieldName, ?string $crmFieldName = null)

        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

        See

        Avoid using undefined variables such as '$fieldName' which will lead to PHP notices.
        Open

                            $name = $fieldLevel ?? $fieldName;

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

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

            public function getFields(bool $onEdit = false): array

        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 '483', column '25').
        Open

                $queryGenerator = new \App\QueryGenerator($moduleName);

        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 getDataCrm has a boolean flag argument $onEdit, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function getDataCrm(bool $onEdit = false): array

        BooleanArgumentFlag

        Since: 1.4.0

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

        Example

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

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

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

                                } else {
                                    $fieldInstance = \Vtiger_Module_Model::getInstance($this->moduleName)->getFieldByName($parsedFieldName);
                                    $fieldInstance->setNoRolePicklistValues([trim($fieldParsedValue)]);
                                }

        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 using static access to class '\App\Fields\Date' in method 'getFieldValue'.
        Open

                                $fieldParsed = \App\Fields\Date::formatToDb($fieldParsed, true);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class '\App\Cache' in method 'getCrmId'.
        Open

                    return \App\Cache::staticGet('CrmIdByMagentoId' . $moduleName, $magentoId);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class '\App\Fields\DateTime' in method 'getFieldValue'.
        Open

                                $fieldParsed = \App\Fields\DateTime::formatToDb($fieldParsed, true);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                } else {
                    $fieldParsed = '';
                }

        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 getFieldValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $fieldParsed = $this->{$methodName}();
                }

        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 using static access to class '\App\Cache' in method 'getCrmId'.
        Open

                \App\Cache::staticSave('CrmIdByMagentoId' . $moduleName, $magentoId, $crmId);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                        } else {
                            $fieldParsed = \is_array($fieldParsed) ? null : $fieldParsed;
                        }

        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 parsePhone uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $parsedData[$fieldName . '_extra'] = trim($parsedData[$fieldName]);
                        unset($parsedData[$fieldName]);
                    }

        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 assigning values to variables in if clauses and the like (line '396', column '14').
        Open

            public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)
            {
                $methodName = 'getCrm' . \ucfirst($fieldNameCrm);
                if (!empty($fieldParsed = $this->getAddressDataByType($type))) {
                    if (\method_exists($this, $methodName)) {

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

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

                        } else {
                            $fieldParsed = $fieldParsed[$fieldName] ?? '';
                        }

        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 using static access to class '\App\Cache' in method 'getCrmId'.
        Open

                if (\App\Cache::staticHas('CrmIdByMagentoId' . $moduleName, $magentoId)) {

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                    } else {
                        $fieldParsed = !\is_array($fieldParsed) ? $fieldParsed : null;
                        if (null === $fieldParsed) {
                            $name = $fieldLevel ?? $fieldName;
                            \App\Log::info("No value in mapping|CRM: $parsedFieldName|Magento: $name|" . PHP_EOL . print_r($fieldParsedValue, true), 'Updates');

        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 using static access to class '\App\Config' in method 'parsePhone'.
        Open

                if (\App\Config::main('phoneFieldAdvancedVerification', false)) {

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class '\libphonenumber\PhoneNumberUtil' in method 'parsePhone'.
        Open

                    $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid assigning values to variables in if clauses and the like (line '401', column '10').
        Open

            public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)
            {
                $methodName = 'getCrm' . \ucfirst($fieldNameCrm);
                if (!empty($fieldParsed = $this->getAddressDataByType($type))) {
                    if (\method_exists($this, $methodName)) {

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

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

                                } else {
                                    if ($elements !== $level + 1) {
                                        $fieldParsed = '';
                                    }
                                    break;

        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 using static access to class '\App\Log' in method 'getFieldValue'.
        Open

                                    \App\Log::info("No value in mapping (map)|name: $parsedFieldName|value: $fieldParsedValue", 'Updates');

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                        } else {
                            $elements = \count($fieldLevels);
                            foreach ($fieldLevels as $level => $fieldLevel) {
                                if (isset($fieldParsed[$fieldLevel])) {
                                    $fieldParsed = $fieldParsed[$fieldLevel];

        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 getFieldValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                                } else {
                                    if ($elements !== $level + 1) {
                                        $fieldParsed = '';
                                    }
                                    break;

        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 getFieldValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $fieldParsed = $fieldParsed[$magentoFieldName] ?? '';
                    }

        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 using static access to class '\App\Fields\Country' in method 'getFieldValue'.
        Open

                                $fieldParsed = \App\Fields\Country::getCountryName($fieldParsed);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

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

                    } else {
                        $fieldLevels = explode('|', $fieldName);
                        if (($elements = \count($fieldLevels)) > 1) {
                            foreach ($fieldLevels as $level => $fieldLevel) {
                                if (isset($fieldParsed[$fieldLevel])) {

        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 using static access to class '\App\Fields\Country' in method 'getAddressFieldValue'.
        Open

                                    $fieldParsed = \App\Fields\Country::getCountryName($fieldParsed);

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Avoid using static access to class '\App\Log' in method 'getFieldValue'.
        Open

                            \App\Log::info("No value in mapping|CRM: $parsedFieldName|Magento: $name|" . PHP_EOL . print_r($fieldParsedValue, true), 'Updates');

        StaticAccess

        Since: 1.4.0

        Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

        Example

        class Foo
        {
            public function bar()
            {
                Bar::baz();
            }
        }

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

        Define a constant instead of duplicating this literal "telephone" 4 times.
        Open

                'phone_a' => 'telephone',

        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

        Noncompliant Code Example

        With the default threshold of 3:

        function run() {
          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
          execute('action1');
          release('action1');
        }
        

        Compliant Solution

        ACTION_1 = 'action1';
        
        function run() {
          prepare(ACTION_1);
          execute(ACTION_1);
          release(ACTION_1);
        }
        

        Exceptions

        To prevent generating some false-positives, literals having less than 5 characters are excluded.

        Define a constant instead of duplicating this literal "country" 4 times.
        Open

                'addresslevel1a' => 'country',

        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

        Noncompliant Code Example

        With the default threshold of 3:

        function run() {
          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
          execute('action1');
          release('action1');
        }
        

        Compliant Solution

        ACTION_1 = 'action1';
        
        function run() {
          prepare(ACTION_1);
          execute(ACTION_1);
          release(ACTION_1);
        }
        

        Exceptions

        To prevent generating some false-positives, literals having less than 5 characters are excluded.

        Remove the unused function parameter "$onEdit".
        Open

            public function getFields(bool $onEdit = false): array

        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

        Noncompliant Code Example

        function doSomething($a, $b) { // "$a" is unused
          return compute($b);
        }
        

        Compliant Solution

        function doSomething($b) {
          return compute($b);
        }
        

        Exceptions

        Functions in classes that override a class or implement interfaces are ignored.

        class C extends B {
        
          function doSomething($a, $b) {     // no issue reported on $b
            compute($a);
          }
        
        }
        

        See

        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
        • CERT, MSC12-CPP. - Detect and remove code that has no effect

        Define a constant instead of duplicating this literal "CrmIdByMagentoId" 3 times.
        Open

                if (\App\Cache::staticHas('CrmIdByMagentoId' . $moduleName, $magentoId)) {

        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

        Noncompliant Code Example

        With the default threshold of 3:

        function run() {
          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
          execute('action1');
          release('action1');
        }
        

        Compliant Solution

        ACTION_1 = 'action1';
        
        function run() {
          prepare(ACTION_1);
          execute(ACTION_1);
          release(ACTION_1);
        }
        

        Exceptions

        To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                        switch (static::$fieldsType[$parsedFieldName]) {

        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

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

                            switch (static::$fieldsType[$fieldNameCrm]) {

        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

        Rename "$data" which has the same name as the field declared at line 69.
        Open

                $data = [];

        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 "$fieldsType" which has the same name as the field declared at line 52.
        Open

                $fieldsType = $type . 'Fields';

        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

        Avoid unused parameters such as '$onEdit'.
        Open

            public function getFields(bool $onEdit = false): array

        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

        Avoid unused local variables such as '$fieldName'.
        Open

                            $name = $fieldLevel ?? $fieldName;

        UnusedLocalVariable

        Since: 0.2

        Detects when a local variable is declared and/or assigned, but not used.

        Example

        class Foo {
            public function doSomething()
            {
                $i = 5; // Unused
            }
        }

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

        Reference to constant INTERNATIONAL from undeclared class \libphonenumber\PhoneNumberFormat
        Open

                        $international = $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL);

        Call to method setStateCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
        Open

                $queryGenerator->setStateCondition('All');

        Call to method setFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
        Open

                $queryGenerator->setFields(['id'])->permissions = false;

        Call to method info from undeclared class \App\Log
        Open

                            \App\Log::info("No value in mapping|CRM: $parsedFieldName|Magento: $name|" . PHP_EOL . print_r($fieldParsedValue, true), 'Updates');

        Call to method __construct from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
        Open

                $queryGenerator = new \App\QueryGenerator($moduleName);

        Argument 2 (key) is int but \App\Cache::staticGet() takes string defined at /code/app/Cache.php:128
        Open

                    return \App\Cache::staticGet('CrmIdByMagentoId' . $moduleName, $magentoId);

        Argument 2 (key) is int but \App\Cache::staticHas() takes string defined at /code/app/Cache.php:141
        Open

                if (\App\Cache::staticHas('CrmIdByMagentoId' . $moduleName, $magentoId)) {

        Call to method info from undeclared class \App\Log
        Open

                                    \App\Log::info("No value in mapping (map)|name: $parsedFieldName|value: $fieldParsedValue", 'Updates');

        Catching undeclared class \libphonenumber\NumberParseException
        Open

                    } catch (\libphonenumber\NumberParseException $e) {

        Variable $fieldName is undeclared
        Open

                            $name = $fieldLevel ?? $fieldName;

        Call to method getInstance from undeclared class \libphonenumber\PhoneNumberUtil
        Open

                    $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();

        Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
        Open

                $queryGenerator->addCondition('magento_server_id', $this->synchronizer->config->get('id'), 'e');

        Call to method createQuery from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
        Open

                $crmId = $queryGenerator->createQuery()->scalar() ?: 0;

        Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
        Open

                $queryGenerator->addCondition('magento_id', $magentoId, 'e');

        Argument 2 (key) is int but \App\Cache::staticSave() takes string defined at /code/app/Cache.php:156
        Open

                \App\Cache::staticSave('CrmIdByMagentoId' . $moduleName, $magentoId, $crmId);

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

            /**

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

             * Mapped fields type.

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

            public $dataCrm = [];

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

                'addresslevel1a' => 'country_id',

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

                'last_name_a' => 'lastname',

        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

             * Data from Magento.

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

                'first_name_a' => 'firstname',

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

                'vat_id_a' => 'vat_id',

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

            public static $shippingFields = [

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

             * @param array $data

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

                        $this->dataCrm[$name] = !empty($value) ? $value : $this->getFieldValue($name);

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

             * Get field value from Magento.

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

             * @param string      $magentoFieldName

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

                        switch (static::$fieldsType[$parsedFieldName]) {

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

                                if (null === $fieldParsed) {

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

                                    \App\Log::info("No value in mapping (map)|name: $parsedFieldName|value: $fieldParsedValue", 'Updates');

        Line exceeds 120 characters; contains 182 characters
        Open

         * The file is part of the paid functionality. Using the file is allowed only after purchasing a subscription. File modification allowed only with the consent of the system producer.

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

             * @var \App\Integrations\Magento\Synchronizer\Base

        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

                'buildingnumbera' => 'street|1',

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

             * Data from YetiForce.

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

                'addresslevel2b' => 'region|region',

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

             *

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

                'addresslevel7a' => 'postcode',

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

             *

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

                'first_name_b' => 'firstname',

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

            public function getFields(bool $onEdit = false): array

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

                '2' => 'PLL_WOMAN',

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

                return static::$additionalFieldsCrm;

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

             * Constructor.

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

            public function setDataCrm(array $data): void

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

             * @param string $name

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

                $this->dataCrm = $data;

        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

                $methodName = 'getCrm' . \ucfirst($parsedFieldName);

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

                $fieldLevels = explode('|', $magentoFieldName);

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

                            foreach ($fieldLevels as $level => $fieldLevel) {

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

                            $fieldParsed = $this->getCustomAttributeValue(end($fieldLevels));

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

                                } else {

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

                                    $fieldParsed = $fieldParsed[$fieldLevel];

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

                                    }

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

                                        $fieldParsed = '';

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

                    if (null !== $fieldParsed && isset(static::$fieldsType[$parsedFieldName])) {

        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 $moduleName;

        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 $data = [];

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

            public static $billingFields = [

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

                'addresslevel2a' => 'region|region',

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

                'phone' => 'telephone',

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

             *

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

                'addresslevel1b' => 'country_id',

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

                'last_name_b' => 'lastname',

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

                'mobile' => 'fax',

        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 mixed|string

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

             * @param bool $onEdit

        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 additional YetiForce fields list.

        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 getFieldValue(string $magentoFieldName, ?string $crmFieldName = null)

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

                                $fieldParsed = static::${$parsedFieldName}[$fieldParsed] ?? null;

        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

                'salutationtype' => 'map',

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

                'vat_id_b' => 'vat_id',

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

                'phone' => 'telephone',

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

             *

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

                $this->synchronizer = $synchronizer;

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

                return array_flip(static::$mappedFields)[$name] ?? $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

            public function getAdditionalFieldsCrm(): array

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

            {

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

                    $this->dataCrm[$fieldCrm] = $this->getFieldValue($field, $fieldCrm) ?? null;

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

                                if (isset($fieldParsed[$fieldLevel])) {

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

                                    if ($elements !== $level + 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

             * Mapped billing fields.

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

                'phone_a' => 'telephone',

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

                'addresslevel7b' => 'postcode',

        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 $data

        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

             * Map module name.

        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

             * @var array

        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

             */

        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 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

            {

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

             *

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

                    foreach ($this->getAdditionalFieldsCrm() as $name => $value) {

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

             * @return array|mixed

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

            {

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

                    $fieldParsedValue = $fieldParsed;

        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

             * @var 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

                'addresslevel5a' => 'city',

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

                'email_b' => 'email',

        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

                return static::$mappedFields;

        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

                foreach ($this->getFields($onEdit) as $fieldCrm => $field) {

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

                if (!$onEdit) {

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

                        if ('custom_attributes' === $fieldLevels[0]) {

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

                        $fieldParsed = $fieldParsed[$magentoFieldName] ?? '';

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

             * Mapped fields.

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

            public static $fieldsType = [

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

                '1' => 'Mr.',

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

                '2' => 'Mrs.',

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

                '1' => 'PLL_MAN',

        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 __construct(\App\Integrations\Magento\Synchronizer\Base $synchronizer)

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

            public function getFieldNameCrm(string $name)

        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

             *

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

            public function setData(array $data): void

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

            public function getDataCrm(bool $onEdit = false): array

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

                            $elements = \count($fieldLevels);

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

                                }

        Line exceeds 120 characters; contains 131 characters
        Open

                                    \App\Log::info("No value in mapping (map)|name: $parsedFieldName|value: $fieldParsedValue", 'Updates');

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

            protected $synchronizer;

        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

             * Mapped shipping fields.

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

                'buildingnumberb' => 'street|1',

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

                'phone_b' => 'telephone',

        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

                }

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

                                    break;

        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

                'addresslevel1a' => 'country',

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

            /**

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

                'email_a' => 'email',

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

                'addresslevel5b' => 'city',

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

            ];

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

             * Contacts_gender map.

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

             * Set data.

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

                $this->data = $data;

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

             * @param bool $onEdit

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

                return $this->dataCrm;

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

             * @param string|null $crmFieldName

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

                    if (\count($fieldLevels) > 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

                            case 'map':

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

             * Fields which are not exist in Magento but needed in YetiForce.

        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

             * Fields default value.

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

                'mobile' => 'fax',

        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

            /**

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

                    }

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

                    $fieldParsed = $this->data;

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

                                }

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

                                break;

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

             * Synchronizer.

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

            public static $mappedFields = [];

        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

            /**

        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

                'company_name_a' => 'company',

        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

                'addresslevel8b' => 'street|0',

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

             * Contacts_gender map.

        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 \App\Integrations\Magento\Synchronizer\Base $synchronizer

        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 fields list.

        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

             */

        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

            public static $fieldsDefaultValue = [];

        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

                'addresslevel8a' => 'street|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

            public static $gender = [

        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 data YetiForce.

        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

                        } else {

        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

            public static $salutationtype = [

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

             * Return YetiForce field 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

             */

        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 parsed data in YetiForce format.

        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 (!\method_exists($this, $methodName)) {

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

                    } else {

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

            public static $additionalFieldsCrm = [];

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

                'gender' => 'map',

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

                'addresslevel1b' => 'country',

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

                'company_name_b' => 'company',

        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

                $parsedFieldName = $crmFieldName ?? $this->getFieldNameCrm($magentoFieldName);

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

                            case 'mapAndAddNew':

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

                            case 'datetime':

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

                                break;

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

                return $value;

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

             * Parse phone number.

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

                    try {

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

                        $international = $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL);

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

                        $international = false;

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

                        unset($parsedData[$fieldName]);

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

             *

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

                            case 'implode':

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

                        $fieldParsed = !\is_array($fieldParsed) ? $fieldParsed : null;

        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 parsePhone(string $fieldName, array $parsedData): array

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

             * Return address data.

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

            {

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

                        $fieldParsed = $this->{$methodName}();

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

                                if (isset(static::${$parsedFieldName}[$fieldParsed])) {

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

                                $fieldParsed = \App\Fields\Country::getCountryName($fieldParsed);

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

                $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

                        if (($elements = \count($fieldLevels)) > 1) {

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

                                } else {

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

                                    $fieldParsed = static::${$parsedFieldName}[$fieldParsed] ?? $fieldParsed;

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

                                    $fieldInstance = \Vtiger_Module_Model::getInstance($this->moduleName)->getFieldByName($parsedFieldName);

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

                                $fieldParsed = \App\Fields\DateTime::formatToDb($fieldParsed, true);

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

                return \is_array($fieldParsed) ? $fieldParsed : trim($fieldParsed);

        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 ($international) {

        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

                                    if ($elements !== $level + 1) {

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

                                break;

        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 custom attribute value.

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

            public function getCustomAttributeValue(string $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

             *

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

                    $addressData[$fieldNameCrm] = $this->getAddressFieldValue($type, $fieldNameCrm, $fieldName);

        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 $fields ?? [];

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

                                        $fieldParsed = '';

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

                                    $fieldInstance->setNoRolePicklistValues([trim($fieldParsedValue)]);

        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 ($name === $customAttribute['attribute_code']) {

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

                    } else {

        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

             *

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

                                }

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

                                } else {

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

                return $parsedData;

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

                $addressData = [];

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

                    if (\method_exists($this, $methodName)) {

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

                                $fieldParsed = implode(', ', $fieldParsed);

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

                            \App\Log::info("No value in mapping|CRM: $parsedFieldName|Magento: $name|" . PHP_EOL . print_r($fieldParsedValue, true), 'Updates');

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

             * @param string $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

            {

        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

            {

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

                    } catch (\libphonenumber\NumberParseException $e) {

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

                        $parsedData[$fieldName . '_extra'] = trim($parsedData[$fieldName]);

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

                        if (null !== $fieldParsed && isset(static::$fieldsType[$fieldNameCrm])) {

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

                            case 'date':

        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 mixed

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

                        $parsedData[$fieldName] = $international;

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

             * @param string $type

        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 $fieldNameCrm

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

             * @return array|mixed

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

            {

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

                $methodName = 'getCrm' . \ucfirst($fieldNameCrm);

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

                        $fieldLevels = explode('|', $fieldName);

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

                                if (isset($fieldParsed[$fieldLevel])) {

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

                                break;

        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

                if (\App\Config::main('phoneFieldAdvancedVerification', 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

             * @return array

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

                if (!empty($fieldParsed = $this->getAddressDataByType($type))) {

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

                    } else {

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

                        } else {

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

                            $fieldParsed = $fieldParsed[$fieldName] ?? '';

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

                            switch (static::$fieldsType[$fieldNameCrm]) {

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

                                case 'implode':

        Line exceeds 120 characters; contains 132 characters
        Open

                                    $fieldInstance = \Vtiger_Module_Model::getInstance($this->moduleName)->getFieldByName($parsedFieldName);

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

                                break;

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

                            $name = $fieldLevel ?? $fieldName;

        Line exceeds 120 characters; contains 152 characters
        Open

                            \App\Log::info("No value in mapping|CRM: $parsedFieldName|Magento: $name|" . PHP_EOL . print_r($fieldParsedValue, true), 'Updates');

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

                            $value = $customAttribute['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

            }

        Line exceeds 120 characters; contains 121 characters
        Open

                        $international = $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL);

        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 $fieldName

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

            public function getAddressFieldValue(string $type, string $fieldNameCrm, string $fieldName)

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

                                break;

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

                            case 'parentRecord':

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

                                $fieldParsed = $this->getCrmId((int) $fieldParsed);

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

                        if (null === $fieldParsed) {

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

                    }

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

                    $fieldParsed = $this->{$methodName}();

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

                    $fields = static::${$fieldsType};

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

             */

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

                                    break;

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

                            case 'country':

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

             *

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

                    foreach ($customAttributes as $customAttribute) {

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

             * @param string $fieldName

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

                foreach ($this->getAddressFieldsCrm($type) as $fieldNameCrm => $fieldName) {

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

             * Return address fields crm.

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

             * @param string $type

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

             * Get address field value from Magento.

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

                                }

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

                    } else {

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

                } else {

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

                $customAttributes = $this->data['custom_attributes'];

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

                    $phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();

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

                        $swissNumberProto = $phoneUtil->parse(trim($parsedData[$fieldName]));

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

            public function getAddressDataCrm(string $type): array

        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 getAddressFieldsCrm(string $type): array

        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 $addressData;

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

                $fieldsType = $type . 'Fields';

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

                if (!empty(static::${$fieldsType})) {

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

             * @param string $type

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

                                    $fieldParsed = $fieldParsed[$fieldLevel];

        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

                } else {

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

                return $data ?? current($this->data['addresses']) ?? [];

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

                }

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

                $crmId = $queryGenerator->createQuery()->scalar() ?: 0;

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

                                break;

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

                                $fieldParsed = \App\Fields\Date::formatToDb($fieldParsed, true);

        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 (!empty($customAttributes)) {

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

             * @param array  $parsedData

        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

                            foreach ($fieldLevels as $level => $fieldLevel) {

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

                }

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

                $addressName = 'default_' . $addressType;

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

             *

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

                $queryGenerator->addCondition('magento_id', $magentoId, 'e');

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

             * @param string|null $moduleName

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

                                    $fieldParsed = \App\Fields\Country::getCountryName($fieldParsed);

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

                    $fieldParsed = '';

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

                    if (isset($this->data[$addressName]) && $address['id'] == $this->data[$addressName]) {

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

                }

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

                $queryGenerator->setStateCondition('All');

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

                \App\Cache::staticSave('CrmIdByMagentoId' . $moduleName, $magentoId, $crmId);

        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 birthday.

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

            public function getCrmId(int $magentoId, ?string $moduleName = null): int

        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 (!$dob || '0000-00-00' === $dob) {

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

            }

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

                                    break;

        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 int

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

            }

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

                                    $fieldParsed = implode(', ', $fieldParsed);

        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

                                case 'country':

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

                                    break;

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

                return trim($fieldParsed);

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

             * Get given type address data.

        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 null;

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

             * Get crm id by magento id.

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

                if (\App\Cache::staticHas('CrmIdByMagentoId' . $moduleName, $magentoId)) {

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

            public function getAddressDataByType(string $addressType)

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

                return date('Y-m-d', strtotime($dob));

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

                $queryGenerator = new \App\QueryGenerator($moduleName);

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

                return $crmId;

        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 function getCrmBirthday()

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

            /**

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

                            $fieldParsed = \is_array($fieldParsed) ? null : $fieldParsed;

        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

                $dob = $this->data['dob'] ?? $this->data['customer_dob'] ?? 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

                if (empty($moduleName)) {

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

                $queryGenerator->setFields(['id'])->permissions = 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

                foreach ($this->data['addresses'] as $address) {

        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 $addressType

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

                $data = [];

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

                        $data = $address;

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

             * @return string|null

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

             *

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

                    $moduleName = $this->moduleName;

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

                    return \App\Cache::staticGet('CrmIdByMagentoId' . $moduleName, $magentoId);

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

                }

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

                        } else {

        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 int         $magentoId

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

                $queryGenerator->addCondition('magento_server_id', $this->synchronizer->config->get('id'), 'e');

        There are no issues that match your filters.

        Category
        Status