YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Method addAdditionalInvData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addAdditionalInvData(): array
    {
        $additionalData = [];
        $additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
        if (!empty($additionalAmount)) {
Severity: Minor
Found in app/Integrations/Magento/Synchronizer/Maps/Order.php - About 1 hr to fix

    Function addAdditionalInvData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addAdditionalInvData(): array
        {
            $additionalData = [];
            $additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
            if (!empty($additionalAmount)) {
    Severity: Minor
    Found in app/Integrations/Magento/Synchronizer/Maps/Order.php - About 55 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 getDataCrm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getDataCrm(bool $onEdit = false): array
        {
            $parsedData = parent::getDataCrm($onEdit);
            if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
                $parsedData = \array_replace_recursive($parsedData, $shippingAddress);
    Severity: Minor
    Found in app/Integrations/Magento/Synchronizer/Maps/Order.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 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

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

        public function getDataCrm(bool $onEdit = false): array
        {
            $parsedData = parent::getDataCrm($onEdit);
            if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
                $parsedData = \array_replace_recursive($parsedData, $shippingAddress);

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

            } else {
                $data = $this->data['billing_address'] ?? [];
            }

    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 '190', column '14').
    Open

        public function getDataCrm(bool $onEdit = false): array
        {
            $parsedData = parent::getDataCrm($onEdit);
            if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
                $parsedData = \array_replace_recursive($parsedData, $shippingAddress);

    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

    Avoid using static access to class '\Vtiger_Inventory_Model' in method 'addAdditionalInvData'.
    Open

                    $taxes = \Vtiger_Inventory_Model::getGlobalTaxes();

    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 '\Vtiger_Record_Model' in method 'addAdditionalInvData'.
    Open

                    $recordModel = \Vtiger_Record_Model::getInstanceById($serviceId, 'Services');

    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 "state" 8 times.
    Open

            'ssingleorders_status' => 'state',

    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 "PLL_ON_HOLD" 3 times.
    Open

            'holded' => 'PLL_ON_HOLD',

    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 "ssingleorders_status" 4 times.
    Open

            'ssingleorders_status' => 'state',

    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 "mapAndAddNew" 3 times.
    Open

            'payment_methods' => 'mapAndAddNew',

    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 "PLL_PAYMENT_REVIEW" 3 times.
    Open

            'payment_review' => 'PLL_PAYMENT_REVIEW',

    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 "price" 3 times.
    Open

            'price' => 'price',

    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 "complete" 4 times.
    Open

            'complete' => 'PLL_COMPLETE',

    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 "canceled" 4 times.
    Open

            'canceled' => 'PLL_CANCELLED',

    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 "shipping" 3 times.
    Open

            if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {

    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 "PLL_CLOSED" 3 times.
    Open

            'closed' => 'PLL_CLOSED',

    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 "payment_review" 4 times.
    Open

            'payment_review' => 'PLL_PAYMENT_REVIEW',

    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 "PLL_COMPLETE" 3 times.
    Open

            'complete' => 'PLL_COMPLETE',

    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 "PLL_PROCESSING" 3 times.
    Open

            'processing' => 'PLL_PROCESSING',

    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 "PLL_CANCELLED" 3 times.
    Open

            'canceled' => 'PLL_CANCELLED',

    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 "processing" 4 times.
    Open

            'processing' => 'PLL_PROCESSING',

    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 "holded" 4 times.
    Open

            'holded' => 'PLL_ON_HOLD',

    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 "status" 8 times.
    Open

            'status_magento' => 'status',

    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 "closed" 4 times.
    Open

            'closed' => 'PLL_CLOSED',

    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.

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

        public function getDataCrm(bool $onEdit = false): array
        {
            $parsedData = parent::getDataCrm($onEdit);
            if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {
                $parsedData = \array_replace_recursive($parsedData, $shippingAddress);
    Severity: Major
    Found in app/Integrations/Magento/Synchronizer/Maps/Order.php and 1 other location - About 7 hrs to fix
    app/Integrations/Magento/Synchronizer/Maps/Invoice.php on lines 83..105

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 224.

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

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

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

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

    Refactorings

    Further Reading

    The property $ssingleorders_status is not named in camelCase.
    Open

    class Order extends Inventory
    {
        /** {@inheritdoc} */
        protected $moduleName = 'SSingleOrders';
        /** {@inheritdoc} */

    CamelCasePropertyName

    Since: 0.2

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

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $payment_methods is not named in camelCase.
    Open

    class Order extends Inventory
    {
        /** {@inheritdoc} */
        protected $moduleName = 'SSingleOrders';
        /** {@inheritdoc} */

    CamelCasePropertyName

    Since: 0.2

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

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $status_magento is not named in camelCase.
    Open

    class Order extends Inventory
    {
        /** {@inheritdoc} */
        protected $moduleName = 'SSingleOrders';
        /** {@inheritdoc} */

    CamelCasePropertyName

    Since: 0.2

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

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    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

        ];

    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

            'payment_review' => 'PLL_PAYMENT_REVIEW',

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

            'pending_payment' => 'PLL_PENDING_PAYMENT',

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

            'paypal_canceled_reversal' => 'PLL_PAYPAL_CANCELED_REVERSAL',

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

        public static $payment_methods = [

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

                    $serviceId = $this->synchronizer->config->get('payment_cash_service_id');

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

                        'currency' => $this->dataCrm['currency_id'],

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

                        'qty' => 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

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

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

        /** {@inheritdoc} */

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

            'subject' => 'increment_id',

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

         */

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

            'name' => 'product_id',

    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

            'complete' => 'PLL_COMPLETE',

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

            'redsys' => 'PLL_REDSYS',

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

            'cashondelivery' => 'PLL_CASH_ON_DELIVERY',

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

                    }

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

                        'taxmode' => 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

            'sale_date' => 'created_at',

    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

         * status_magento field 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

         *

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

                if ('paypal_express' === $this->data['payment']['method']) {

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

                        $additionalAmount = round($additionalAmount * 100 / (100 + $tax), 4);

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

                        'subunit' => '',

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

                        'purchase' => 0,

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

        /** {@inheritdoc} */

    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 [

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

        protected $moduleName = 'SSingleOrders';

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

            'sale_date' => '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

         *

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

            'PLL_CANCELLED' => ['state' => 'canceled', 'status' => 'canceled'],

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

        ];

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

         * @var array

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

        {

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

                    $taxes = \Vtiger_Inventory_Model::getGlobalTaxes();

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

                        'name' => $serviceId,

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

                        'unit' => '',

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

            if (!empty($parsedData['phone_a'])) {

    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

            'ssingleorders_source' => 'PLL_MAGENTO',

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

            'ssingleorders_status' => 'state',

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

            'attention' => 'customer_note',

    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

            'pending' => 'PLL_PENDING',

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

            'pending_paypal' => 'PLL_PENDING_PAYPAL',

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

            'paid' => 'PLL_PAID',

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

         *

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

         * Payment method value map.

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

            'paypal_express' => 'PLL_PAYPAL_EXPRESS',

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

            $additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];

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

                        'comment1' => '',

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

            'sum_total' => '',

    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

            $parsedData = parent::getDataCrm($onEdit);

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

            'leadsource' => 'Magento',

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

            if (!empty($parsedData['phone'])) {

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

        /**

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

            'new' => 'PLL_NEW',

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

        }

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

            'paypal_reversed' => 'PLL_PAYPAL_REVERSED',

    Line exceeds 120 characters; contains 158 characters
    Open

            $additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];

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

                        'taxparam' => '{"aggregationType":"individual","individualTax":' . $tax . '}',

    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($parsedData['phone_b'])) {

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

            return $this->dataCrm = $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

        public static $additionalFieldsCrm = [

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

            'parent_id' => 'relation_parent_id',

    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

         */

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

            'PLL_PAYMENT_REVIEW' => ['state' => 'payment_review', 'status' => 'payment_review'],

    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

            $additionalData = [];

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

                    $tax = 0;

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

                    $additionalData = [

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

            if (!empty($billingAddress = $this->getAddressDataCrm('billing'))) {

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

            if (!empty($parsedData['mobile'])) {

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

            }

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

        /** {@inheritdoc} */

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

                $data = $this->data['extension_attributes']['shipping_assignments'][0]['shipping']['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

                return [];

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

            'parent_id' => 'parentRecord',

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

        public static $status_magento = [

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

            'fraud' => 'PLL_FRAUD',

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

            'closed' => 'PLL_CLOSED',

    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 ('shipping' === $addressType) {

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

                    'increment_id' => $this->dataCrm['subject'],

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

            'sum_gross' => '',

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

            'birthday' => 'customer_dob',

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

            'ssingleorders_status' => 'mapAndAddNew',

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

         * Magento state mapping to CRM statuses.

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

            'holded' => 'PLL_ON_HOLD',

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

        /**

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

            'send' => 'PLL_SEND',

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

            'complete' => 'PLL_COMPLETE',

    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

            'PLL_ON_HOLD' => ['state' => 'holded', 'status' => 'holded'],

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

         * Parse additional inventory data.

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

                } elseif ('cashondelivery' === $this->data['payment']['method']) {

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

                        $tax = $taxes[$recordModel->get('taxes')]['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

                'entity' => array_merge([

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

            ];

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

            'date_start' => 'created_at',

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

        /**

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

            'date_start' => 'date',

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

        public static $ssingleorders_status = [

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

            'canceled' => 'PLL_CANCELLED',

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

            'holded' => 'PLL_ON_HOLD',

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

         * Mapping statuses from the CRM to Magento.

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

            'PLL_NEW' => ['state' => 'new', 'status' => 'pending'],

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

                }

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

                        'price' => $additionalAmount,

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

                $parsedData = \array_replace_recursive($parsedData, $shippingAddress);

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

                $parsedData = $this->parsePhone('phone_b', $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

        public function getUpdateData(): array

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

                    self::$statusForMagento[$this->dataCrm['ssingleorders_status']]

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

        /** {@inheritdoc} */

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

        public static $mappedFieldsInv = [

    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

            'status_magento' => 'mapAndAddNew',

    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

            'processing' => 'PLL_PROCESSING',

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

        /**

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

            'PLL_PROCESSING' => ['state' => 'processing', 'status' => 'processing'],

    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

                        'discountmode' => 1,

    Line exceeds 120 characters; contains 131 characters
    Open

                        'discountparam' => '{"aggregationType":"individual","individualDiscountType":"amount","individualDiscount":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

        {

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

        /** {@inheritdoc} */

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

            'price' => 'price',

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

            'closed' => 'PLL_CLOSED',

    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

            'banktransfer' => 'PLL_TRANSFER',

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

                if (!empty($serviceId)) {

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

            }

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

                $parsedData = $this->parsePhone('phone_a', $parsedData);

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

                    'entity_id' => $this->dataCrm['magento_id'],

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

                ],

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

            'sum_tax' => '',

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

            'sum_net' => '',

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

            'firstname' => 'customer_firstname',

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

            'qty' => 'qty_ordered',

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

            'discount' => 'discount_amount',

    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

            'payment_methods' => 'mapAndAddNew',

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

            'payment_review' => 'PLL_PAYMENT_REVIEW',

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

                    $serviceId = $this->synchronizer->config->get('payment_paypal_service_id');

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

                    if (isset($taxes[$recordModel->get('taxes')])) {

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

                        'discountparam' => '{"aggregationType":"individual","individualDiscountType":"amount","individualDiscount":0}',

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

                $parsedData = $this->parsePhone('phone', $parsedData);

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

         * Data update in magento.

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

            'sum_discount' => '',

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

            'payment_status' => '',

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

         * Inventory fields.

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

            'canceled' => 'PLL_CANCELLED',

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

         * It is used when updating data in Magento.

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

        public static $statusForMagento = [

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

            'PLL_CLOSED' => ['state' => 'closed', 'status' => 'closed'],

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

            if (!empty($additionalAmount)) {

    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

                $data = $this->data['billing_address'] ?? [];

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

            if (empty(self::$statusForMagento[$this->dataCrm['ssingleorders_status']])) {

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

            'email' => 'customer_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

            'processing' => 'PLL_PROCESSING',

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

            'PLL_COMPLETE' => ['state' => 'complete', 'status' => 'complete'],

    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 addAdditionalInvData(): array

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

                    $recordModel = \Vtiger_Record_Model::getInstanceById($serviceId, 'Services');

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

            return $additionalData;

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

        }

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

                $parsedData = \array_replace_recursive($parsedData, $billingAddress);

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

            'payment_methods' => 'payment|method',

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

            'status_magento' => 'status',

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

            'salutationtype' => 'customer_gender',

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

            'lastname' => 'customer_lastname',

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

        /** {@inheritdoc} */

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

            if (!empty($shippingAddress = $this->getAddressDataCrm('shipping'))) {

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

                $parsedData = $this->parsePhone('mobile', $parsedData);

    Multi-line function call not indented correctly; expected 16 spaces but found 12
    Open

                ],

    Opening parenthesis of a multi-line function call must be the last content on the line
    Open

                'entity' => array_merge([

    There are no issues that match your filters.

    Category
    Status