YetiForceCompany/YetiForceCRM

View on GitHub
modules/IStorages/textparsers/ProductsTableHierarchy.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

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

    public function process()
    {
        $html = '';
        $relationModuleName = 'Products';
        // Products from main storage
Severity: Minor
Found in modules/IStorages/textparsers/ProductsTableHierarchy.php - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function process()
    {
        $html = '';
        $relationModuleName = 'Products';
        // Products from main storage
Severity: Major
Found in modules/IStorages/textparsers/ProductsTableHierarchy.php - About 4 hrs to fix

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

        public function process()
        {
            $html = '';
            $relationModuleName = 'Products';
            // Products from main storage

    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 113 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        public function process()
        {
            $html = '';
            $relationModuleName = 'Products';
            // Products from main storage

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

        public function process()
        {
            $html = '';
            $relationModuleName = 'Products';
            // Products from main storage

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        public function process()

    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

    Missing class import via use statement (line '69', column '22').
    Open

            $dataReader = (new \App\Db\Query())->select(['qtyinstock', 'relcrmid', 'crmid'])->from('u_#__istorages_products')->where(['crmid' => $storageIdsArray])->createCommand()->query();

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class '\App\Language' in method 'process'.
    Open

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $relationModuleName) . '</th>';

    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('Qty/Unit', $relationModuleName) . '</th>';

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Fields\Double' in method 'process'.
    Open

                            $html .= "<td style=\"{$bodyStyle}\">" . \App\Fields\Double::formatToDisplay($entryRecordModel->get('qty_per_unit'), false) . '</td>';

    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('Qty In Stock', $relationModuleName) . '</th>';

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

            $relationListView = \Vtiger_RelationListView_Model::getInstance($this->textParser->recordModel, $relationModuleName);

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

                    $storageRelationListView = Vtiger_RelationListView_Model::getInstance($storageRecordModel, $relationModuleName);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Fields\Owner' in method 'process'.
    Open

                'assigned_user_id' => \App\Fields\Owner::getLabel($this->textParser->recordModel->get('assigned_user_id'))

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

                    $storageRecordModel = Vtiger_Record_Model::getInstanceById($storageId);

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

                        $entryRecordModel = Vtiger_Record_Model::getInstanceById($entryId, $relationModuleName);

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

            $dataReader = (new \App\Db\Query())->select(['qtyinstock', 'relcrmid', 'crmid'])->from('u_#__istorages_products')->where(['crmid' => $storageIdsArray])->createCommand()->query();

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

                    if (false === isset($storegeSubjectArray[$i]['products'][$productId])) {

    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 .= "<td style=\"{$bodyStyle}\">" . $entryRecordModel->getDisplayValue($header->getName()) . '</td>';

    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->getFieldLabel(), $relationModuleName) . '</th>';

    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.

    Call to method getLabel from undeclared class \App\Fields\Owner
    Open

                'assigned_user_id' => \App\Fields\Owner::getLabel($this->textParser->recordModel->get('assigned_user_id'))

    Call to deprecated function \Vtiger_Field_Model::getFieldLabel() defined at /code/modules/Vtiger/models/Field.php:215
    Open

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $relationModuleName) . '</th>';

    Variable $allEntries was undeclared, but array fields are being added to it.
    Open

            $allEntries[$this->textParser->record] = $relationListView->getAllEntries();

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

                if ($storageId !== $this->textParser->record) {

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

            $relationListView = \Vtiger_RelationListView_Model::getInstance($this->textParser->recordModel, $relationModuleName);

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

            $allEntries[$this->textParser->record] = $relationListView->getAllEntries();

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

                'subject' => $this->textParser->recordModel->get('subject'),

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

            $storageList[$this->textParser->record] = [

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

            $hierarchyList = $focus->getHierarchyData($this->textParser->record, $storageList, $this->textParser->record, $listviewEntries, true);

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

                'assigned_user_id' => \App\Fields\Owner::getLabel($this->textParser->recordModel->get('assigned_user_id'))

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

            $focus = $this->textParser->recordModel->getEntity();

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

            $storageList = $focus->getChildIStorages($this->textParser->record, $storageList[$this->textParser->record], $storageList[$this->textParser->record]['depth']);

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

                if (\is_array($storageInfo) && (int) $storageId && $storageId != $this->textParser->record) {

    Variable $storageList was undeclared, but array fields are being added to it.
    Open

            $storageList[$this->textParser->record] = [

    Call to undeclared method \App\Db\Query::select
    Open

            $dataReader = (new \App\Db\Query())->select(['qtyinstock', 'relcrmid', 'crmid'])->from('u_#__istorages_products')->where(['crmid' => $storageIdsArray])->createCommand()->query();

    Avoid excessively long class names like IStorages_ProductsTableHierarchy_Textparser. Keep class name length under 40.
    Open

    class IStorages_ProductsTableHierarchy_Textparser extends \App\TextParser\Base
    {
        /** @var string Class name */
        public $name = 'LBL_PRODUCTS_TABLE_HIERARCHY';
    
    

    LongClassName

    Since: 2.9

    Detects when classes or interfaces are declared with excessively long names.

    Example

    class ATooLongClassNameThatHintsAtADesignProblem {
    
    }
    
    interface ATooLongInterfaceNameThatHintsAtADesignProblem {
    
    }

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

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

                    $storageRelationListView = Vtiger_RelationListView_Model::getInstance($storageRecordModel, $relationModuleName);

    LongVariable

    Since: 0.2

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

    Example

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

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

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class IStorages_ProductsTableHierarchy_Textparser extends \App\TextParser\Base

    The class IStorages_ProductsTableHierarchy_Textparser is not named in CamelCase.
    Open

    class IStorages_ProductsTableHierarchy_Textparser extends \App\TextParser\Base
    {
        /** @var string Class name */
        public $name = 'LBL_PRODUCTS_TABLE_HIERARCHY';
    
    

    CamelCaseClassName

    Since: 0.2

    It is considered best practice to use the CamelCase notation to name classes.

    Example

    class class_name {
    }

    Source

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

            $focus = $this->textParser->recordModel->getEntity();

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

            $storageSubjectList = '';

    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

        public $type = 'pdf';

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

                'assigned_user_id' => \App\Fields\Owner::getLabel($this->textParser->recordModel->get('assigned_user_id'))

    Line exceeds 120 characters; contains 167 characters
    Open

            $storageList = $focus->getChildIStorages($this->textParser->record, $storageList[$this->textParser->record], $storageList[$this->textParser->record]['depth']);

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

            $hierarchyList = $focus->getHierarchyData($this->textParser->record, $storageList, $this->textParser->record, $listviewEntries, true);

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

            $rowNum = 1;

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

                'subject' => $this->textParser->recordModel->get('subject'),

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

            $storageList = $focus->getChildIStorages($this->textParser->record, $storageList[$this->textParser->record], $storageList[$this->textParser->record]['depth']);

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

            foreach ($hierarchyList as $storageId => $storageInfo) {

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

            $listviewEntries = [];

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

            $storegeSubjectArray = [];

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

            $storageIdsArray = [];

    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

            $relationListView = \Vtiger_RelationListView_Model::getInstance($this->textParser->recordModel, $relationModuleName);

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

            $storageList[$this->textParser->record] = [

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

            // String with all storages (main and its children) names

    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 string

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

            $productModel = $relationListView->getRelatedModuleModel();

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

         */

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

            // Products from main storage

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

            // Hierarchy of main storage (contains child storages)

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

         *

    Line exceeds 120 characters; contains 142 characters
    Open

            $hierarchyList = $focus->getHierarchyData($this->textParser->record, $storageList, $this->textParser->record, $listviewEntries, true);

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

                $storegeSubjectArray[$storageId]['name'] = $storageInfo[0];

    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

            $relationModuleName = 'Products';

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

            $allEntries[$this->textParser->record] = $relationListView->getAllEntries();

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

        {

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

            ];

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

                            }

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

        /** @var string Class name */

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

        public $name = 'LBL_PRODUCTS_TABLE_HIERARCHY';

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

        public function process()

    Line exceeds 120 characters; contains 125 characters
    Open

            $relationListView = \Vtiger_RelationListView_Model::getInstance($this->textParser->recordModel, $relationModuleName);

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

                'depth' => 0,

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

                    $productsQty[$productId] = 0;

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

                $fieldModel = $productModel->getFieldByName($fieldName);

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

                        $entryId = $entry->getId();

    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 ($storageId !== $this->textParser->record) {

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

            $dataReader->close();

    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

                $productsInTable = [];

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

                            foreach ($storegeSubjectArray as $storageData) {

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

                            $html .= "<td style=\"{$bodyStyle}\">" . \App\Fields\Double::formatToDisplay($entryRecordModel->get('qty_per_unit'), false) . '</td>';

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

            // Summary table with products from all storages

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

                $storegeSubjectArray[$storageId]['rowNum'] = $rowNum;

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

                    $storageRecordModel = Vtiger_Record_Model::getInstanceById($storageId);

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

                    $html .= '<tr><td style="width:100%;white-space:nowrap;text-align:right">' . $storageData['rowNum'] . '.</td>';

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

            $columns = [];

    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

            $dataReader = (new \App\Db\Query())->select(['qtyinstock', 'relcrmid', 'crmid'])->from('u_#__istorages_products')->where(['crmid' => $storageIdsArray])->createCommand()->query();

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

                $productId = $row['relcrmid'];

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

            if ('' != $storageSubjectList) {

    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 .= "<th style=\"{$headerStyle}\">" . \App\Language::translate('Qty In Stock', $relationModuleName) . '</th>';

    Line exceeds 120 characters; contains 127 characters
    Open

                            $html .= "<td style=\"{$bodyStyle}\">" . $productsQty[$productId] . ' ' . $storagesQtyString . '</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

                $storageIdsArray[] = $storageId;

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

                    // Getting storage products if it is child of main storage

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

                }

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

            $storageSubjectList = rtrim($storageSubjectList, ', ');

    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 .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $relationModuleName) . '</th>';

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

            if (\count($productsQty) > 0) {

    Line exceeds 120 characters; contains 158 characters
    Open

                            $html .= "<td style=\"{$bodyStyle}\">" . \App\Fields\Double::formatToDisplay($entryRecordModel->get('qty_per_unit'), false) . '</td>';

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

                        $storegeSubjectArray[$i]['products'][$productId] = 0;

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

                $productsQty[$productId] += (float) $qty;

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

                $html .= '<div style="width:50%;float:right;">';

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

                    $html .= '<td style="white-space:nowrap;">' . $storageData['name'] . '</td></tr>';

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

                foreach ($allEntries as $entries) {

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

                    foreach ($entries as $entry) {

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

                if (false === isset($productsQty[$productId])) {

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

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

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

                        $entryRecordModel = Vtiger_Record_Model::getInstanceById($entryId, $relationModuleName);

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

            }

    Line exceeds 120 characters; contains 186 characters
    Open

            $dataReader = (new \App\Db\Query())->select(['qtyinstock', 'relcrmid', 'crmid'])->from('u_#__istorages_products')->where(['crmid' => $storageIdsArray])->createCommand()->query();

    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

            foreach (['productname', 'ean', 'pscategory'] as $fieldName) {

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

                        }

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

                }

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

                    if (false === isset($storegeSubjectArray[$i]['products'][$productId])) {

    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 .= '</div>';

    Line exceeds 120 characters; contains 128 characters
    Open

                    $storageRelationListView = Vtiger_RelationListView_Model::getInstance($storageRecordModel, $relationModuleName);

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

            while ($row = $dataReader->read()) {

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

                $storegeSubjectArray[$storageId]['products'][$productId] += (float) $qty;

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

                $html .= '</table>';

    Line exceeds 120 characters; contains 123 characters
    Open

            $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate('Qty In Stock', $relationModuleName) . '</th>';

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

                                $storagesQtyString .= $storageData['products'][$productId] . ',';

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

                            $productsInTable[] = $productId;

    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

                ++$rowNum;

    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 border="1" class="products-table" style="border-collapse:collapse;width:100%;"><thead><tr>';

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

                $columns[$fieldName] = $fieldModel;

    Line exceeds 120 characters; contains 141 characters
    Open

                $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $relationModuleName) . '</th>';

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

                            $storagesQtyString = '[';

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

                            $storagesQtyString = rtrim($storagesQtyString, ',');

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

                            $storagesQtyString .= ']';

    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

                foreach ($storegeSubjectArray as $i => $storageData) {

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

            }

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

                        $productId = $entryRecordModel->get('id');

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

                            foreach ($columns as $header) {

    Line exceeds 120 characters; contains 134 characters
    Open

                                $html .= "<td style=\"{$bodyStyle}\">" . $entryRecordModel->getDisplayValue($header->getName()) . '</td>';

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

                    $storageRelationListView = Vtiger_RelationListView_Model::getInstance($storageRecordModel, $relationModuleName);

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

            $productsQty = [];

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

                $storageId = $row['crmid'];

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

                $html .= '<table style="width:100%;border-collapse:collapse;font-size:10px;padding:5px;">';

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

                        if (isset($productsQty[$productId]) && false === \in_array($productId, $productsInTable)) {

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

                                $html .= "<td style=\"{$bodyStyle}\">" . $entryRecordModel->getDisplayValue($header->getName()) . '</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

                $html .= '</tbody></table></div>';

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

        }

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

                $qty = $row['qtyinstock'];

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

                if (!$fieldModel || !$fieldModel->isActiveField()) {

    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

                            $html .= "<td style=\"{$bodyStyle}\">" . $productsQty[$productId] . ' ' . $storagesQtyString . '</td>';

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

                    $storageSubjectList .= $storageInfo[0] . ', ';

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

                if (\is_array($storageInfo) && (int) $storageId && $storageId != $this->textParser->record) {

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

                    $allEntries[$storageId] = $storageRelationListView->getAllEntries();

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

            // Gets the sum of products quantity in all storages

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

                    }

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

            }

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

                foreach ($storegeSubjectArray as $storageData) {

    Line exceeds 120 characters; contains 127 characters
    Open

                    $html .= '<tr><td style="width:100%;white-space:nowrap;text-align:right">' . $storageData['rowNum'] . '.</td>';

    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

            $html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate('Qty/Unit', $relationModuleName) . '</th>';

    Class name "IStorages_ProductsTableHierarchy_Textparser" is not in camel caps format
    Open

    class IStorages_ProductsTableHierarchy_Textparser extends \App\TextParser\Base

    There are no issues that match your filters.

    Category
    Status