YetiForceCompany/YetiForceCRM

View on GitHub
app/TextParser/ProductsTable.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Function process has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    public function process()
    {
        $html = '';
        $inventoryRows = [];
        if (!$this->textParser->recordModel->getModule()->isInventory()) {
Severity: Minor
Found in app/TextParser/ProductsTable.php - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method process has 155 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process()
    {
        $html = '';
        $inventoryRows = [];
        if (!$this->textParser->recordModel->getModule()->isInventory()) {
Severity: Major
Found in app/TextParser/ProductsTable.php - About 6 hrs to fix

    The method process() has an NPath complexity of 345672. The configured NPath complexity threshold is 200.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    NPathComplexity

    Since: 0.1

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

    Example

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

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

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

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

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

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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

    This function "process" has 157 lines, which is greater than the 150 lines authorized. Split it into smaller functions.
    Open

        public function process()
    Severity: Major
    Found in app/TextParser/ProductsTable.php by sonar-php

    A function that grows too large tends to aggregate too many responsibilities.

    Such functions inevitably become harder to understand and therefore harder to maintain.

    Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.

    Those smaller functions will not only be easier to understand, but also probably easier to test.

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

        public function process()
    Severity: Critical
    Found in app/TextParser/ProductsTable.php by sonar-php

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

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\App\Language' in method 'process'.
    Open

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

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

                        } else {
                            $fieldValue = $fieldModel->getDisplayValue($itemValue, $inventoryRow);
                        }
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Currency' in method 'process'.
    Open

                $currencyData = \App\Fields\Currency::getDefault();
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

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

                    } else {
                        $groupModels[$columnName] = $fieldModel;
                    }
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Language' in method 'process'.
    Open

                                    <td class="name" style="padding:0px 4px;">' . \App\Language::translate('LBL_AMOUNT', $this->textParser->moduleName) . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '80', column '131').
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\App\Fields\Currency' in method 'process'.
    Open

                $currencyData = \App\Fields\Currency::getById($currency);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

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

            } else {
                $currencyData = \App\Fields\Currency::getDefault();
            }
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Language' in method 'process'.
    Open

                                            <th style="padding:0px 4px;" colspan="2">' . \App\Language::translate('LBL_CURRENCIES_SUMMARY', $this->textParser->moduleName) . '</th>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Language' in method 'process'.
    Open

                                        <th style="text-align:center;">' . \App\Language::translate('LBL_DISCOUNTS_SUMMARY', $this->textParser->moduleName) . '</th>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                                        <td style="border:1px solid #ddd;text-align:right;padding:0px 4px;">' . \CurrencyField::convertToUserFormat($discount, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Language' in method 'process'.
    Open

                                        <th style="padding:0px 4px;font-weight:bold;" colspan="2">' . \App\Language::translate('LBL_TAX_SUMMARY', $this->textParser->moduleName) . '</th>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax_AMOUNT, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                                    <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($currencyAmount * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Language' in method 'process'.
    Open

                        $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . ': ' . $fieldModel->getDisplayValue($firstRow[$columnName]) . '</th>';
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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_Inventory_Model' in method 'process'.
    Open

            $inventory = \Vtiger_Inventory_Model::getInstance($this->textParser->moduleName);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                            $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                                            <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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\Language' in method 'process'.
    Open

                                        <td class="name" style="padding:0px 4px;">' . \App\Language::translate('LBL_AMOUNT', $this->textParser->moduleName) . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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_Util_Helper' in method 'process'.
    Open

            $baseCurrency = \Vtiger_Util_Helper::getBaseCurrency();
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    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 '\CurrencyField' in method 'process'.
    Open

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

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

            if ($inventory->isField('currency')) {
    Severity: Critical
    Found in app/TextParser/ProductsTable.php by sonar-php

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

                        $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . ': ' . $fieldModel->getDisplayValue($firstRow[$columnName]) . '</th>';
    Severity: Critical
    Found in app/TextParser/ProductsTable.php by sonar-php

    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 "currency_symbol" 6 times.
    Open

                $currencySymbol = $currencyData['currency_symbol'];
    Severity: Critical
    Found in app/TextParser/ProductsTable.php by sonar-php

    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.

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                        $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . ': ' . $fieldModel->getDisplayValue($firstRow[$columnName]) . '</th>';
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 1 (currencyValue) is string but \CurrencyField::appendCurrencySymbol() takes \Number defined at /code/include/fields/CurrencyField.php:225
    Open

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to undeclared method \Vtiger_Basic_InventoryField::getTaxParam
    Open

                        $taxes = $taxField->getTaxParam($inventoryRow['taxparam'], $inventoryRow['net'], $taxes);
    Severity: Critical
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                                        <td style="border:1px solid #ddd;text-align:right;padding:0px 4px;">' . \CurrencyField::convertToUserFormat($discount, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                                    <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($currencyAmount * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property recordModel from undeclared class \App\TextParser
    Open

            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                                        <th style="text-align:center;">' . \App\Language::translate('LBL_DISCOUNTS_SUMMARY', $this->textParser->moduleName) . '</th>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property recordModel from undeclared class \App\TextParser
    Open

            $inventoryRows = $this->textParser->recordModel->getInventoryData();
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                                            <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                                    <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($currencyAmount * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                                        <td style="border:1px solid #ddd;text-align:right;padding:0px 4px;">' . \CurrencyField::convertToUserFormat($discount, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                                        <th style="padding:0px 4px;font-weight:bold;" colspan="2">' . \App\Language::translate('LBL_TAX_SUMMARY', $this->textParser->moduleName) . '</th>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax_AMOUNT, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

            $inventory = \Vtiger_Inventory_Model::getInstance($this->textParser->moduleName);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                                        <td class="name" style="padding:0px 4px;">' . \App\Language::translate('LBL_AMOUNT', $this->textParser->moduleName) . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                                            <th style="padding:0px 4px;" colspan="2">' . \App\Language::translate('LBL_CURRENCIES_SUMMARY', $this->textParser->moduleName) . '</th>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax_AMOUNT, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                                    <td class="name" style="padding:0px 4px;">' . \App\Language::translate('LBL_AMOUNT', $this->textParser->moduleName) . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                                            <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

    Argument 1 (currencyValue) is string but \CurrencyField::appendCurrencySymbol() takes \Number defined at /code/include/fields/CurrencyField.php:225
    Open

                            $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phan

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

            foreach (['Name', 'Quantity', 'Discount', 'Currency', 'DiscountMode', 'TaxMode', 'UnitPrice', 'GrossPrice', 'NetPrice', 'Tax', 'TotalPrice', 'Value'] as $fieldType) {
                foreach ($inventory->getFieldsByType($fieldType) as $fieldModel) {
                    $columnName = $fieldModel->getColumnName();
                    if (!$fieldModel->isVisible()) {
                        continue;
    Severity: Major
    Found in app/TextParser/ProductsTable.php and 1 other location - About 4 hrs to fix
    app/TextParser/ProductsTableCorrectingBefore.php on lines 52..64

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

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

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

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

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

    Refactorings

    Further Reading

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

        public $name = 'LBL_PRODUCTS_TABLE';

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

        public $type = 'pdf';

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

        /** @var string Class name */

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

            foreach (['Name', 'Quantity', 'Discount', 'Currency', 'DiscountMode', 'TaxMode', 'UnitPrice', 'GrossPrice', 'NetPrice', 'Tax', 'TotalPrice', 'Value'] as $fieldType) {

    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 ($inventoryRows as $key => $inventoryRow) {

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

                            $styleField = $bodyStyle . ' text-align:right;';

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

                    $html .= '</th>';

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

                if ($inventory->isField('tax') && $inventory->isField('net')) {

    Line exceeds 120 characters; contains 160 characters
    Open

                                        <th style="text-align:center;">' . \App\Language::translate('LBL_DISCOUNTS_SUMMARY', $this->textParser->moduleName) . '</th>

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

                $html .= '</td><td style="vertical-align:top">';

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

                        $html .= '<tr>

    Line exceeds 120 characters; contains 122 characters
    Open

                        $html .= '<table class="products-table-summary-currency" style="width:100%;border-collapse:collapse;">

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

                        $html .= '<tr class="summary" style="border:1px solid #ddd;">

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

        /** @var mixed Parser 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

            $baseCurrency = \Vtiger_Util_Helper::getBaseCurrency();

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

            $html .= '</tr></thead></table>';

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

                        $styleField = $bodyStyle;

    Line exceeds 120 characters; contains 149 characters
    Open

                        } elseif (\in_array($typeName, ['TotalPrice', 'Purchase', 'NetPrice', 'GrossPrice', 'UnitPrice', 'Discount', 'Margin', 'Tax'])) {

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

                            $fieldValue = $fieldModel->getDisplayValue($itemValue, $inventoryRow);

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

                        }

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

                $html .= '</tbody><tfoot><tr>';

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

                    $html .= "<th style=\"{$headerStyle}\">";

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

                    }

    Line exceeds 120 characters; contains 216 characters
    Open

                                        <td style="border:1px solid #ddd;text-align:right;padding:0px 4px;">' . \CurrencyField::convertToUserFormat($discount, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>

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

                if ($inventory->isField('tax') && $inventory->isField('taxmode')) {

    Line exceeds 120 characters; contains 181 characters
    Open

                                        <th style="padding:0px 4px;font-weight:bold;" colspan="2">' . \App\Language::translate('LBL_TAX_SUMMARY', $this->textParser->moduleName) . '</th>

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

         * Process.

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

         * @return string

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

            $groupModels = [];

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

                                $commentFieldName = $commentField->getColumnName();

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

                foreach ($groupModels as $fieldModel) {

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

                        foreach ($inventoryRows as $key => $inventoryRow) {

    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

                    }

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

                                if ($inventory->isField($commentFieldName) && $commentField->isVisible() && ($value = $inventoryRow[$commentFieldName]) && $comment = $commentField->getDisplayValue($value, $inventoryRow)) {

    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 += $inventoryRow[$fieldModel->getColumnName()];

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

                $html .= '</tr></tfoot></table>';

    Line exceeds 120 characters; contains 211 characters
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>

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

                }

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

            $inventoryRows = [];

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

            $inventory = \Vtiger_Inventory_Model::getInstance($this->textParser->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

                        continue;

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

            if ($groupModels) {

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

                    $html .= '<tr class="summary" style="border:1px solid #ddd;">

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

                $html .= '</td></tr></table>';

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

            if ($inventory->isField('currency')) {

    Line exceeds 120 characters; contains 218 characters
    Open

                        $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . ': ' . $fieldModel->getDisplayValue($firstRow[$columnName]) . '</th>';

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

                                    $fieldValue .= '<br />' . $comment;

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

                    $taxField = $inventory->getField('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

                $html .= '<table class="products-table-summary" style="padding:10px 0px;border-collapse:collapse; font-family:\'Noto Sans\'; font-size:8px; margin:0px 0px 20px 0px; width:100%">

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

                    $tax_AMOUNT = 0;

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

                        $html .= '<table class="products-table-summary-currency" style="width:100%;border-collapse:collapse;">

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

            return $html;

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

        public function process()

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

            $html = '';

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

            if (!$this->textParser->recordModel->getModule()->isInventory()) {

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

                return $html;

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

                $currencySymbol = $currencyData['currency_symbol'];

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

            $html = '<table  class="products-table" style="border-collapse:collapse;width:100%;"><thead><tr>';

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

                        $groupModels[$columnName] = $fieldModel;

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

            foreach ($groupModels as $fieldModel) {

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

                    $html .= '<tr>';

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

                        } elseif (\in_array($typeName, ['TotalPrice', 'Purchase', 'NetPrice', 'GrossPrice', 'UnitPrice', 'Discount', 'Margin', 'Tax'])) {

    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

                    $html .= '</tr>';

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

                    if ($fieldModel->isSummary()) {

    Line exceeds 120 characters; contains 138 characters
    Open

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);

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

                }

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

                        $RATE = $baseCurrency['conversion_rate'] / $currencyData['conversion_rate'];

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

            $headerStyle = 'font-size:9px;padding:0px 4px;text-align:center;';

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

                }

    Line exceeds 120 characters; contains 189 characters
    Open

                $html .= '<table class="products-table-summary" style="padding:10px 0px;border-collapse:collapse; font-family:\'Noto Sans\'; font-size:8px; margin:0px 0px 20px 0px; width:100%">

    Line exceeds 120 characters; contains 210 characters
    Open

                                        <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax_AMOUNT, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>

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

                    if ($inventory->isField('currency') && $baseCurrency['id'] != $currency) {

    Line exceeds 120 characters; contains 175 characters
    Open

                                            <th style="padding:0px 4px;" colspan="2">' . \App\Language::translate('LBL_CURRENCIES_SUMMARY', $this->textParser->moduleName) . '</th>

    Line exceeds 120 characters; contains 174 characters
    Open

            foreach (['Name', 'Quantity', 'Discount', 'Currency', 'DiscountMode', 'TaxMode', 'UnitPrice', 'GrossPrice', 'NetPrice', 'Tax', 'TotalPrice', 'Value'] as $fieldType) {

    Line exceeds 120 characters; contains 148 characters
    Open

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

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

                $html .= '<tbody>';

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

                        $html .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);

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

                    foreach ($inventoryRows as $key => $inventoryRow) {

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

                        $taxes = $taxField->getTaxParam($inventoryRow['taxparam'], $inventoryRow['net'], $taxes);

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

                    foreach ($taxes as $key => &$tax) {

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

                        $tax_AMOUNT += $tax;

    Line exceeds 120 characters; contains 156 characters
    Open

                                    <td class="name" style="padding:0px 4px;">' . \App\Language::translate('LBL_AMOUNT', $this->textParser->moduleName) . '</td>

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

         */

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

            $firstRow = current($inventoryRows);

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

                        $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . ': ' . $fieldModel->getDisplayValue($firstRow[$columnName]) . '</th>';

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

                }

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

            $html .= '<table class="products-table-header" style="border-collapse:collapse;width:100%;"><thead><tr>';

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

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

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

                            $fieldValue = "<strong>{$fieldModel->getDisplayValue($itemValue, $inventoryRow)}</strong>";

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

                            $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);

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

                    }

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

            $inventoryRows = $this->textParser->recordModel->getInventoryData();

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

            }

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

                        $typeName = $fieldModel->getType();

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

                        $html .= "<td class=\"col-type-{$typeName}\" style=\"{$styleField}\">{$fieldValue}</td>";

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

                        $sum = 0;

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

                $currency = $inventoryRows && $firstRow['currency'] ? $firstRow['currency'] : $baseCurrency['id'];

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

                $currencyData = \App\Fields\Currency::getDefault();

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

            $bodyStyle = 'font-size:8px;border:1px solid #ddd;padding:0px 4px;';

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

                        $itemValue = $inventoryRow[$fieldModel->getColumnName()];

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

                        if ('Name' === $typeName) {

    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

                            $html .= '<tr>

    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

                    foreach ($groupModels as $fieldModel) {

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

                    $discount = $inventory->getField('discount')->getSummaryValuesFromData($inventoryRows);

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

                        $currencyAmount = 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

                $currencyData = \App\Fields\Currency::getById($currency);

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

                            foreach ($inventory->getFieldsByType('Comment') as $commentField) {

    Line exceeds 120 characters; contains 218 characters
    Open

                                if ($inventory->isField($commentFieldName) && $commentField->isVisible() && ($value = $inventoryRow[$commentFieldName]) && $comment = $commentField->getDisplayValue($value, $inventoryRow)) {

    Line exceeds 120 characters; contains 149 characters
    Open

                            $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);

    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 ($inventory->getFieldsByType($fieldType) as $fieldModel) {

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

                    $columnName = $fieldModel->getColumnName();

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

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

                if ($inventory->isField('discount') && $inventory->isField('discountmode')) {

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

                    $html .= '<table class="products-table-summary-discount" style="width:100%;border-collapse:collapse;">

    Line exceeds 120 characters; contains 207 characters
    Open

                                            <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($tax, null, true) . ' ' . $currencyData['currency_symbol'] . '</td>

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

                    }

    Line exceeds 120 characters; contains 160 characters
    Open

                                        <td class="name" style="padding:0px 4px;">' . \App\Language::translate('LBL_AMOUNT', $this->textParser->moduleName) . '</td>

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

                        foreach ($taxes as $key => &$tax) {

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

                            $currencyAmount += $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

        }

    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 (!$fieldModel->isVisible()) {

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

                    if (\in_array($fieldModel->getType(), ['Currency', 'DiscountMode', 'TaxMode'])) {

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

            $html .= '</tr></thead>';

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

                }

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

                    $html .= '

    Line exceeds 120 characters; contains 218 characters
    Open

                                    <td class="value" style="padding:0px 4px;text-align:right;">' . \CurrencyField::convertToUserFormat($currencyAmount * $RATE, null, true) . ' ' . $baseCurrency['currency_symbol'] . '</td>

    The variable $RATE is not named in camelCase.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $RATE is not named in camelCase.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $tax_AMOUNT is not named in camelCase.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $tax_AMOUNT is not named in camelCase.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $RATE is not named in camelCase.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $tax_AMOUNT is not named in camelCase.
    Open

        public function process()
        {
            $html = '';
            $inventoryRows = [];
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTable.php by phpmd

    CamelCaseVariableName

    Since: 0.2

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

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status