YetiForceCompany/YetiForceCRM

View on GitHub
modules/Import/readers/XmlReader.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Function read has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function read()
    {
        $defaultCharset = App\Config::main('default_charset');
        $this->createTable();

Severity: Minor
Found in modules/Import/readers/XmlReader.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function getRecordDataFromXMLTemplate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRecordDataFromXMLTemplate(XMLReader $xmlToImport)
    {
        $recordData = [];
        $recordNum = 0;
        $firstElement = '';
Severity: Minor
Found in modules/Import/readers/XmlReader.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

The class Import_XmlReader_Reader has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
Open

class Import_XmlReader_Reader extends Import_FileReader_Reader
{
    protected $moduleName;
    protected $skipField = ['assigned_user_id', 'productid'];
    protected $skipRecord = 0;
Severity: Minor
Found in modules/Import/readers/XmlReader.php by phpmd

Method read has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function read()
    {
        $defaultCharset = App\Config::main('default_charset');
        $this->createTable();

Severity: Minor
Found in modules/Import/readers/XmlReader.php - About 1 hr to fix

    Function getInventoryData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getInventoryData(XMLReader $xmlToImport, $keyType)
        {
            $recordInventoryData = [];
            $labels = [];
            $columnsName = [];
    Severity: Minor
    Found in modules/Import/readers/XmlReader.php - About 1 hr 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 getRecordDataFromXMLTemplate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRecordDataFromXMLTemplate(XMLReader $xmlToImport)
        {
            $recordData = [];
            $recordNum = 0;
            $firstElement = '';
    Severity: Minor
    Found in modules/Import/readers/XmlReader.php - About 1 hr to fix

      Function getRecordDataFromXML has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getRecordDataFromXML(XMLReader $xmlToImport, $keyType = 'label')
          {
              $recordData = [];
              $recordInventoryData = [];
              $isInventory = false;
      Severity: Minor
      Found in modules/Import/readers/XmlReader.php - About 1 hr 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 getInventoryData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getInventoryData(XMLReader $xmlToImport, $keyType)
          {
              $recordInventoryData = [];
              $labels = [];
              $columnsName = [];
      Severity: Minor
      Found in modules/Import/readers/XmlReader.php - About 1 hr to fix

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

            public function arrayCombine($key, $value)
            {
                $combine = [];
                $dup = [];
                $countKey = \count($key);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php - About 25 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        The method read() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
        Open

            public function read()
            {
                $defaultCharset = App\Config::main('default_charset');
                $this->createTable();
        
        
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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 getRecordDataFromXMLTemplate() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public function getRecordDataFromXMLTemplate(XMLReader $xmlToImport)
            {
                $recordData = [];
                $recordNum = 0;
                $firstElement = '';
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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

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

            public function read()
            {
                $defaultCharset = App\Config::main('default_charset');
                $this->createTable();
        
        
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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

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

            public function getRecordDataFromXMLTemplate(XMLReader $xmlToImport)
        Severity: Critical
        Found in modules/Import/readers/XmlReader.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

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

            public function read()
        Severity: Critical
        Found in modules/Import/readers/XmlReader.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 using undefined variables such as '$labels' which will lead to PHP notices.
        Open

                            $labels[] = \App\Purifier::purify($xmlToImport->getAttribute('label'));
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        UndefinedVariable

        Since: 2.8.0

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

        Example

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

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

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

                    $recordData = $this->arrayCombine($labels, $recordData);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        UndefinedVariable

        Since: 2.8.0

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

        Example

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

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

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

            public function getFirstRowData($hasHeader = true)
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

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

        Example

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

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

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

                $xmlToImport = new XMLReader();
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        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

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

                $xmlToImport = new XMLReader();
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        MissingImport

        Since: 2.7.0

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

        Example

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

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

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

                } else {
                    $recordInventoryData = $this->inventoryData['data'];
                }
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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

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

                } else {
                    [$recordData, $recordsInventoryData] = $this->getRecordDataFromXML($xmlToImport);
                    $recordData = ['LBL_STANDARD_FIELDS' => $recordData, 'LBL_INVENTORY_FIELDS' => $recordsInventoryData];
                }
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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 'Vtiger_Inventory_Model' in method 'read'.
        Open

                    $inventoryModel = Vtiger_Inventory_Model::getInstance($this->moduleName);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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\Purifier' in method 'read'.
        Open

                    $mappedData[$fieldName] = isset($fields[$fieldName]) && 'text' === $fields[$fieldName]->getFieldDataType() ? \App\Purifier::purifyHtml($fieldValue) : \App\Purifier::purify($fieldValue);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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\Purifier' in method 'getInventoryData'.
        Open

                        $label = \App\Purifier::purify($xmlToImport->getAttribute('label'));
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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 getRecordDataFromXMLTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                                } else {
                                    $info['val'] = $xmlToImport->readString();
                                    $recordData[$recordNum][$this->request->get('module')][] = $info;
                                }
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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 'Import_Module_Model' in method 'createTable'.
        Open

                $tableName = Import_Module_Model::getDbTableName($this->user);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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\Purifier' in method 'getRecordDataFromXML'.
        Open

                            $labels[] = \App\Purifier::purify($xmlToImport->getAttribute('label'));
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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\Config' in method 'read'.
        Open

                $defaultCharset = App\Config::main('default_charset');
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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_Module_Model' in method 'read'.
        Open

                $moduleModel = Vtiger_Module_Model::getInstance($this->moduleName);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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 '\vtlib\Utils' in method 'createTable'.
        Open

                if (!\vtlib\Utils::checkTable($tableName)) {
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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\Purifier' in method 'read'.
        Open

                    $mappedData[$fieldName] = isset($fields[$fieldName]) && 'text' === $fields[$fieldName]->getFieldDataType() ? \App\Purifier::purifyHtml($fieldValue) : \App\Purifier::purify($fieldValue);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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 getRecordDataFromXMLTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                            } else {
                                if ('true' == $info['notrepeat']) {
                                    if ('LineNumber' == $xmlToImport->localName) {
                                        $lineProd = $xmlToImport->readString();
                                    }
        Severity: Minor
        Found in modules/Import/readers/XmlReader.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

        Define a constant instead of duplicating this literal "label" 5 times.
        Open

            public function getRecordDataFromXML(XMLReader $xmlToImport, $keyType = 'label')
        Severity: Critical
        Found in modules/Import/readers/XmlReader.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.

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

                                foreach ($fieldModel->getCustomColumn() as $columnParamsName => $dataType) {
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        UnusedLocalVariable

        Since: 0.2

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

        Example

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

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

        Avoid unused parameters such as '$hasHeader'.
        Open

            public function getFirstRowData($hasHeader = true)
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        UnusedFormalParameter

        Since: 0.2

        Avoid passing parameters to methods or constructors and then not using those parameters.

        Example

        class Foo
        {
            private function bar($howdy)
            {
                // $howdy is not used
            }
        }

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

        Reference to undeclared property \Import_XmlReader_Reader->filePath
        Open

                if (isset($this->filePath)) {
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Call to deprecated function \Import_XmlReader_Reader::convertCharacterEncoding() defined at /code/modules/Import/readers/FileReader.php:94
        Open

                        $fieldValue = $this->convertCharacterEncoding($fieldValue, $this->request->get('file_encoding'), $defaultCharset);
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
        Open

            public function __construct(App\Request $request, App\User $user)
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Reference to undeclared property \Import_XmlReader_Reader->filePath
        Open

                    return $this->filePath;
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Reference to undeclared property \Import_XmlReader_Reader->inventoryData
        Open

                    $recordInventoryData = $this->inventoryData['data'];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Reference to undeclared property \Import_XmlReader_Reader->inventoryData
        Open

                $columnsName = $this->inventoryData['tags'] ?? [];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Argument 1 (keys) is null but \array_combine() takes int[]|string[]
        Open

                $this->inventoryData = ['labels' => array_combine($labels[0], $recordInventoryData[0]), 'tags' => $columnsName[0], 'data' => $recordInventoryData];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Reference to undeclared property \Import_XmlReader_Reader->inventoryData
        Open

                $this->inventoryData = ['labels' => array_combine($labels[0], $recordInventoryData[0]), 'tags' => $columnsName[0], 'data' => $recordInventoryData];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

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

                            $labels[] = \App\Purifier::purify($xmlToImport->getAttribute('label'));
        Severity: Info
        Found in modules/Import/readers/XmlReader.php by phan

        Invalid offset 0 of array type array{-1:array<int>}|array{}</int>
        Open

                $this->inventoryData = ['labels' => array_combine($labels[0], $recordInventoryData[0]), 'tags' => $columnsName[0], 'data' => $recordInventoryData];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Call to undeclared method \Import_XmlReader_Reader::getFieldInfoByTagName
        Open

                        $info = $this->getFieldInfoByTagName($xmlToImport->localName);
        Severity: Critical
        Found in modules/Import/readers/XmlReader.php by phan

        Argument 2 (values) is null but \array_combine() takes array
        Open

                $this->inventoryData = ['labels' => array_combine($labels[0], $recordInventoryData[0]), 'tags' => $columnsName[0], 'data' => $recordInventoryData];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

        Reference to undeclared property \Import_XmlReader_Reader->inventoryData
        Open

                    $recordInventoryData = $this->inventoryData['labels'];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phan

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

                $inventoryFieldMapping = $this->request->get('inventory_field_mapping');
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        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

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

            protected $relatedInventoryField = [];
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        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 Import_XmlReader_Reader extends Import_FileReader_Reader

        The class Import_XmlReader_Reader is not named in CamelCase.
        Open

        class Import_XmlReader_Reader extends Import_FileReader_Reader
        {
            protected $moduleName;
            protected $skipField = ['assigned_user_id', 'productid'];
            protected $skipRecord = 0;
        Severity: Minor
        Found in modules/Import/readers/XmlReader.php by phpmd

        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

            protected $importedRecords = 0;

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

             * @param \App\User    $user

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

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

            public function getFirstRowData($hasHeader = true)

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

                $xmlToImport = new XMLReader();

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

                }

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

            protected $moduleName;

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

                if ($this->isTemplate()) {

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

             * Constructor.

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

            public function __construct(App\Request $request, App\User $user)

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

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

            public function getFilePath()

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

             *

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

            public function hasHeader()

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

            }

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

                    $recordData = ['LBL_STANDARD_FIELDS' => $recordData, 'LBL_INVENTORY_FIELDS' => $recordsInventoryData];

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

                    unset($recordData['LBL_INVENTORY_FIELDS']);

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

            }

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

            protected $skipField = ['assigned_user_id', 'productid'];

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

                $xmlToImport->open($this->getFilePath());

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

            {

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

                    $recordData = $this->getRecordDataFromXMLTemplate($xmlToImport);

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

            protected $skipRecord = 0;

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

            protected $relatedInventoryField = [];

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

             * @param \App\Request $request

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

                $this->moduleName = $request->getModule();

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

                parent::__construct($request, $user);

        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

                if (empty($recordsInventoryData)) {

        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

                    $mappedData[$fieldName] = isset($fields[$fieldName]) && 'text' === $fields[$fieldName]->getFieldDataType() ? \App\Purifier::purifyHtml($fieldValue) : \App\Purifier::purify($fieldValue);

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

                    if (!empty($fieldValue)) {

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

                        $allValuesEmpty = false;

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

                        foreach ($data as $key => $fieldValue) {

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

                                    if (\in_array($columnParamsName, $columnsName)) {

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

                        $this->addInventoryToDB($inventoryMappedData, $importId);

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

                $countKey = \count($key);

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

                        if (!\in_array($xmlToImport->localName, ['MODULE_FIELDS', 'INVENTORY_ITEM', 'INVENTORY_ITEMS'])) {

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

                if ('label' == $keyType) {

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

                $labels = [];

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

                while ($xmlToImport->read()) {

        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

                $xmlToImport->open($this->getFilePath());

        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

                        $labels[$index][] = $label;

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

                if (isset($this->filePath)) {

        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 (!\vtlib\Utils::checkTable($tableName)) {

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

             * Function reads data from file and adds to database.

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

                                foreach ($fieldModel->getCustomColumn() as $columnParamsName => $dataType) {

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

            {

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

                $recordData = [];

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

                    [$recordData, $recordsInventoryData] = $this->getRecordDataFromXML($xmlToImport);

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

                            }

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

                            $dup[$key[$i]] = 1;

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

                        }

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

                $recordInventoryData = [];

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

                    if (XMLReader::ELEMENT == $xmlToImport->nodeType) {

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

            public function getRecordDataFromXMLTemplate(XMLReader $xmlToImport)

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

                    return $this->filePath;

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

                $tableName = Import_Module_Model::getDbTableName($this->user);

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

                    $inventoryModel = Vtiger_Inventory_Model::getInstance($this->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

                            $recordInventoryData = $this->getInventoryData($xmlToImport, $keyType);

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

                            break;

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

                    }

        Line exceeds 120 characters; contains 155 characters
        Open

                $this->inventoryData = ['labels' => array_combine($labels[0], $recordInventoryData[0]), 'tags' => $columnsName[0], 'data' => $recordInventoryData];

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

                if ('label' === $keyType) {

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

                return parent::getFilePath();

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

                                $inventoryMappedData[$index][$fieldName] = $fieldValue;

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

                    if ($importId && $inventoryMappedData) {

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

                    $combine[$key[$i]] = $value[$i];

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

                            $label = $xmlToImport->localName;

        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

                    parent::createTable();

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

            public function read()

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

            {

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

                                        $key = array_search($columnParamsName, $columnsName);

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

                    if (XMLReader::ELEMENT == $xmlToImport->nodeType) {

        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

            /**

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

                $this->createTable();

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

                [$recordData, $recordsInventoryData] = $this->getRecordDataFromXML($xmlToImport, false);

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

                $moduleModel = Vtiger_Module_Model::getInstance($this->moduleName);

        Line exceeds 120 characters; contains 197 characters
        Open

                    $mappedData[$fieldName] = isset($fields[$fieldName]) && 'text' === $fields[$fieldName]->getFieldDataType() ? \App\Purifier::purifyHtml($fieldValue) : \App\Purifier::purify($fieldValue);

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

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

                                        $inventoryMappedData[$index][$columnParamsName] = $data[$key];

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

                        }

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

                $recordData = [];

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

                $isInventory = false;

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

            public function getInventoryData(XMLReader $xmlToImport, $keyType)

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

                $recordInventoryData = [];

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

                        if (empty($label)) {

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

                        $columnsName[$index][] = $xmlToImport->localName;

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

                $this->inventoryData = ['labels' => array_combine($labels[0], $recordInventoryData[0]), 'tags' => $columnsName[0], 'data' => $recordInventoryData];

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

                foreach ($fieldMapping as $fieldName => $index) {

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

                    $fieldValue = $recordData[$index];

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

                    $inventoryFields = $inventoryModel->getFields();

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

                if (!$allValuesEmpty) {

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

                $dup = [];

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

                    if (\array_key_exists($key[$i], $combine)) {

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

                }

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

                $recordNum = 0;

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

                $defaultCharset = App\Config::main('default_charset');

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

                            $fieldName = array_search($key, $inventoryFieldMapping);

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

                                    }

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

                    }

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

                return !empty($this->request->get('xml_import_tpl'));

        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

                        $recordInventoryData[$index][] = $xmlToImport->readString();

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

            public function createTable()

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

                }

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

                $inventoryFieldMapping = $this->request->get('inventory_field_mapping');

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

                $fields = $moduleModel->getFields();

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

                    if ($this->request->get('file_encoding') !== $defaultCharset) {

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

                        $fieldValue = $this->convertCharacterEncoding($fieldValue, $this->request->get('file_encoding'), $defaultCharset);

        Line exceeds 120 characters; contains 130 characters
        Open

                        $fieldValue = $this->convertCharacterEncoding($fieldValue, $this->request->get('file_encoding'), $defaultCharset);

        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

                for ($i = 0; $i < $countKey; ++$i) {

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

                }

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

                        } elseif ($isInventory && 'INVENTORY_ITEMS' == $xmlToImport->localName) {

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

                $columnsName = [];

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

                        $label = \App\Purifier::purify($xmlToImport->getAttribute('label'));

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

            {

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

                            $fieldModel = $inventoryFields[$fieldName];

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

                        if (!isset($dup[$key[$i]])) {

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

                        $key[$i] = $key[$i] . ' (' . ++$dup[$key[$i]] . ')';

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

            {

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

                            $recordData[] = $xmlToImport->readString();

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

                    $recordInventoryData = $this->inventoryData['data'];

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

                return $recordInventoryData;

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

                $xmlToImport = new XMLReader();

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

                $mappedData = [];

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

                $allValuesEmpty = true;

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

                if ($inventoryFieldMapping && $recordsInventoryData) {

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

                                }

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

                    $importId = $this->addRecordToDB($mappedData);

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

                return $combine;

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

            public function getRecordDataFromXML(XMLReader $xmlToImport, $keyType = 'label')

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

                    $isInventory = true;

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

                while ($xmlToImport->read()) {

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

                }

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

                            ++$index;

        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

                $columnsName = $this->inventoryData['tags'] ?? [];

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

                    }

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

            public function arrayCombine($key, $value)

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

                $combine = [];

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

                    $recordData = $this->arrayCombine($labels, $recordData);

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

            }

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

                $index = -1;

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

                        if ('INVENTORY_ITEM' == $xmlToImport->localName) {

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

                        }

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

                    $recordInventoryData = $this->inventoryData['labels'];

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

             * Function creates tables for import in database.

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

             */

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

                $fieldMapping = $this->request->get('field_mapping');

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

            public function isTemplate()

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

            }

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

                            $labels[] = \App\Purifier::purify($xmlToImport->getAttribute('label'));

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

                return [$recordData, $recordInventoryData];

        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

                $inventoryMappedData = [];

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

                    foreach ($recordsInventoryData as $index => $data) {

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

                }

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

            }

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

                if ($this->moduleModel->isInventory()) {

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

            {

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

                $lineProd = '';

        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 ($info && 'product' != $info['type']) {

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

                    if (XMLReader::END_ELEMENT == $xmlToImport->nodeType && $xmlToImport->localName == $firstElement) {

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

                }

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

                $firstElement = '';

        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

                        ++$recordNum;

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

                                    $info['val'] = $xmlToImport->readString();

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

                        $info = $this->getFieldInfoByTagName($xmlToImport->localName);

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

                                $info['val'] = $xmlToImport->readString();

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

                            ++$recordNum;

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

                                    $recordData[$recordNum][$this->request->get('module')]['prod_line'][$lineProd][] = $info;

        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 (0 == $recordNum) {

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

                                    }

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

                                    $recordData[$recordNum][$this->request->get('module')][] = $info;

        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

                        $lineProd = '';

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

                                if ('true' == $info['notrepeat']) {

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

                                }

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

                            $firstElement = $xmlToImport->localName;

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

                                    if ('LineNumber' == $xmlToImport->localName) {

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

                                        $lineProd = $xmlToImport->readString();

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

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

                while ($xmlToImport->read()) {

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

                    if (XMLReader::ELEMENT == $xmlToImport->nodeType) {

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

                                $recordData[$recordNum][$info['refmoule']][] = $info;

        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

                            if ('reference' == $info['crmfieldtype']) {

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

                                    $info['val'] = $xmlToImport->readString();

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

            }

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

        class Import_XmlReader_Reader extends Import_FileReader_Reader

        There are no issues that match your filters.

        Category
        Status