YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/ExportToXml.php

Summary

Maintainability
D
1 day
Test Coverage
F
0%

Function createXml has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public function createXml($entries, $entriesInventory)
    {
        $exportBlockName = \App\Config::component('Export', 'BLOCK_NAME');
        $xml = new \XMLWriter();
        $xml->openMemory();
Severity: Minor
Found in modules/Vtiger/models/ExportToXml.php - About 5 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function sanitizeInventoryValue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function sanitizeInventoryValue($value, $columnName): string
    {
        if ($field = $this->inventoryFields[$columnName] ?? false) {
            if (\in_array($field->getType(), ['Name', 'Reference'])) {
                $value = trim($value);
Severity: Minor
Found in modules/Vtiger/models/ExportToXml.php - About 2 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 createXml has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createXml($entries, $entriesInventory)
    {
        $exportBlockName = \App\Config::component('Export', 'BLOCK_NAME');
        $xml = new \XMLWriter();
        $xml->openMemory();
Severity: Major
Found in modules/Vtiger/models/ExportToXml.php - About 2 hrs to fix

    Method sanitizeInventoryValue has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function sanitizeInventoryValue($value, $columnName): string
        {
            if ($field = $this->inventoryFields[$columnName] ?? false) {
                if (\in_array($field->getType(), ['Name', 'Reference'])) {
                    $value = trim($value);
    Severity: Minor
    Found in modules/Vtiger/models/ExportToXml.php - About 1 hr to fix

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

          public function exportData()
          {
              $fileName = str_replace(' ', '_', \App\Purifier::decodeHtml(\App\Language::translate($this->moduleName, $this->moduleName)));
              $entriesInventory = [];
              $addInventoryData = $this->fullData && $this->moduleInstance->isInventory();
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function sanitizeInventoryValue($value, $columnName): string
          {
              if ($field = $this->inventoryFields[$columnName] ?? false) {
                  if (\in_array($field->getType(), ['Name', 'Reference'])) {
                      $value = trim($value);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 createXml() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
      Open

          public function createXml($entries, $entriesInventory)
          {
              $exportBlockName = \App\Config::component('Export', 'BLOCK_NAME');
              $xml = new \XMLWriter();
              $xml->openMemory();
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 34 to the 15 allowed.
      Open

          public function createXml($entries, $entriesInventory)
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.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 20 to the 15 allowed.
      Open

          public function sanitizeInventoryValue($value, $columnName): string
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.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

      Missing class import via use statement (line '149', column '14').
      Open

              $zip = new ZipArchive();
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 '81', column '22').
      Open

              $dataReader = (new \App\Db\Query())->from($table)->where(['crmid' => $recordData['id']])->orderBy(['seq' => SORT_ASC])->createCommand()->query();
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 '182', column '14').
      Open

              $xml = new \XMLWriter();
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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

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

          public function sanitizeInventoryValue($value, $columnName): string
          {
              if ($field = $this->inventoryFields[$columnName] ?? false) {
                  if (\in_array($field->getType(), ['Name', 'Reference'])) {
                      $value = trim($value);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

      Avoid using static access to class '\App\Json' in method 'sanitizeInventoryValue'.
      Open

                      $value = \App\Json::encode($valueNewData);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 exportData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $this->createXml($this->sanitizeValues($row), $entriesInventory);
                  }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 sanitizeInventoryValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $value = '';
                      }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

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

      Avoid using static access to class '\App\Config' in method 'createXml'.
      Open

              $exportBlockName = \App\Config::component('Export', 'BLOCK_NAME');
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 'createXml'.
      Open

                      $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->getBlockName()), $this->moduleName) . '::' . $header;
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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\Record' in method 'sanitizeInventoryValue'.
      Open

                          $displayValue = \App\Record::getLabel($value);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                              $xml->writeAttribute('label', \App\Language::translate(html_entity_decode($fieldModel->get('label'), ENT_QUOTES), $this->moduleName));
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

          public function isCData($name, $customColumns = [])
          {
              if ($customColumns) {
                  return \array_key_exists($name, $customColumns);
              }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\Currency' in method 'sanitizeInventoryValue'.
      Open

      }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 createXml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                          } else {
                              $xml->text($this->sanitizeInventoryValue($value, $columnName));
                          }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

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

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

              $fileName = str_replace(' ', '_', \App\Purifier::decodeHtml(\App\Language::translate($this->moduleName, $this->moduleName)));
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

          public function createXml($entries, $entriesInventory)
          {
              $exportBlockName = \App\Config::component('Export', 'BLOCK_NAME');
              $xml = new \XMLWriter();
              $xml->openMemory();
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

                      $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->getBlockName()), $this->moduleName) . '::' . $header;
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 'exportData'.
      Open

              $fileName = str_replace(' ', '_', \App\Purifier::decodeHtml(\App\Language::translate($this->moduleName, $this->moduleName)));
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 sanitizeInventoryValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                          } else {
                              $value = '';
                          }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

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

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

                  $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->get('label')), $this->moduleName);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 createXml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $xml->text($entries[$fieldName]);
                  }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

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

      Avoid using static access to class '\App\Purifier' in method 'createXml'.
      Open

                  $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->get('label')), $this->moduleName);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 exportData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $this->outputFile($fileName);
              }
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 'getEntriesInventory'.
      Open

              $inventoryModel = Vtiger_Inventory_Model::getInstance($this->moduleName);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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\Record' in method 'sanitizeInventoryValue'.
      Open

                          $recordModule = \App\Record::getType($value);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->get('label')), $this->moduleName);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.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 parameters such as '$entries'.
      Open

          public function createXmlFromTemplate($entries, $entriesInventory)
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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

      Avoid unused parameters such as '$entriesInventory'.
      Open

          public function createXmlFromTemplate($entries, $entriesInventory)
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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

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

                                  foreach ($fieldModel->getCustomColumn() as $key => $dataType) {
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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

      Call to method writeCData from undeclared class \XMLWriter
      Open

                      $xml->writeCData($entries[$fieldName]);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method startElement from undeclared class \XMLWriter
      Open

                  $xml->startElement($fieldName);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

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

              $dataReader = (new \App\Db\Query())->from($table)->where(['crmid' => $recordData['id']])->orderBy(['seq' => SORT_ASC])->createCommand()->query();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method startElement from undeclared class \XMLWriter
      Open

                  $xml->startElement('INVENTORY_ITEMS');
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method startElement from undeclared class \XMLWriter
      Open

                      $xml->startElement('INVENTORY_ITEM');
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method endElement from undeclared class \XMLWriter
      Open

                      $xml->endElement();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Reference to undeclared property \Vtiger_ExportToXml_Model->xmlList
      Open

                  $this->xmlList[] = $this->tmpXmlPath;
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Reference to undeclared property \Vtiger_ExportToXml_Model->xmlList
      Open

                  $xmlFile = basename($this->xmlList[$i]);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method startElement from undeclared class \XMLWriter
      Open

                          $xml->startElement($columnName);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method writeAttribute from undeclared class \XMLWriter
      Open

                              $xml->writeAttribute('label', \App\Language::translate(html_entity_decode($fieldModel->get('label'), ENT_QUOTES), $this->moduleName));
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method flush from undeclared class \XMLWriter
      Open

              file_put_contents($this->tmpXmlPath, $xml->flush(true), FILE_APPEND);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method __construct from undeclared class \XMLWriter
      Open

              $xml = new \XMLWriter();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method endElement from undeclared class \XMLWriter
      Open

                  $xml->endElement();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Argument 1 (recordId) is string but \App\Record::getType() takes int defined at /code/app/Record.php:279
      Open

                          $recordModule = \App\Record::getType($value);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Reference to undeclared property \Vtiger_ExportToXml_Model->xmlList
      Open

                  $zip->addFile($this->xmlList[$i], $xmlFile);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method startDocument from undeclared class \XMLWriter
      Open

              $xml->startDocument('1.0', 'UTF-8');
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method text from undeclared class \XMLWriter
      Open

                              $xml->text($this->sanitizeInventoryValue($value, $columnName));
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method text from undeclared class \XMLWriter
      Open

                      $xml->text($entries[$fieldName]);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method endElement from undeclared class \XMLWriter
      Open

              $xml->endElement();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Reference to undeclared property \Vtiger_ExportToXml_Model->xmlList
      Open

              array_map('unlink', $this->xmlList);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to undeclared method \Vtiger_Basic_InventoryField::getCurrencyParam
      Open

                      $valueData = $field->getCurrencyParam([], $value);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Reference to undeclared property \Vtiger_ExportToXml_Model->xmlList
      Open

              $countXmlList = \count($this->xmlList);
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method writeAttribute from undeclared class \XMLWriter
      Open

                  $xml->writeAttribute('label', $header);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method endElement from undeclared class \XMLWriter
      Open

                  $xml->endElement();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method read from undeclared class \yii\db\DataReader
      Open

              while ($row = $dataReader->read()) {
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method openMemory from undeclared class \XMLWriter
      Open

              $xml->openMemory();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method setIndent from undeclared class \XMLWriter
      Open

              $xml->setIndent(true);
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method writeAttribute from undeclared class \XMLWriter
      Open

                  $xml->writeAttribute('type', $fieldModel->getFieldDataType());
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method endElement from undeclared class \XMLWriter
      Open

                          $xml->endElement();
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method startElement from undeclared class \XMLWriter
      Open

              $xml->startElement('MODULE_FIELDS');
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

      Call to method writeCData from undeclared class \XMLWriter
      Open

                              $xml->writeCData($this->sanitizeInventoryValue($value, $columnName));
      Severity: Critical
      Found in modules/Vtiger/models/ExportToXml.php by phan

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

                  if (\in_array($field->getType(), ['Name', 'Reference'])) {
                      $value = trim($value);
                      if (!empty($value)) {
                          $recordModule = \App\Record::getType($value);
                          $displayValue = \App\Record::getLabel($value);
      Severity: Major
      Found in modules/Vtiger/models/ExportToXml.php and 1 other location - About 3 hrs to fix
      app/Export/Records.php on lines 324..339

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 152.

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

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

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

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

      Refactorings

      Further Reading

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

      class Vtiger_ExportToXml_Model extends \App\Export\Records

      The class Vtiger_ExportToXml_Model is not named in CamelCase.
      Open

      class Vtiger_ExportToXml_Model extends \App\Export\Records
      {
          protected $attrList = ['crmfield', 'crmfieldtype', 'partvalue', 'constvalue', 'refmoule', 'spec', 'refkeyfld', 'delimiter', 'testcondition'];
          protected $product = false;
          protected $tplName = '';
      Severity: Minor
      Found in modules/Vtiger/models/ExportToXml.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 $tplName = '';

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

          protected $fileExtension = 'xml';

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

          protected $inventoryFields;

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

          protected $product = false;

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

          protected $tmpXmlPath = '';

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

          protected $attrList = ['crmfield', 'crmfieldtype', 'partvalue', 'constvalue', 'refmoule', 'spec', 'refkeyfld', 'delimiter', 'testcondition'];

      Line exceeds 120 characters; contains 145 characters
      Open

          protected $attrList = ['crmfield', 'crmfieldtype', 'partvalue', 'constvalue', 'refmoule', 'spec', 'refkeyfld', 'delimiter', 'testcondition'];

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

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

                      $this->createXmlFromTemplate($row, $entriesInventory);

      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

              $this->inventoryFields = $inventoryModel->getFields();

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

              }

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

           * Sanitize inventory value.

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

                          $displayValue = \App\Record::getLabel($value);

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

              header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

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

              $countXmlList = \count($this->xmlList);

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

                  $xmlFile = explode('_', $xmlFile);

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

              $entriesInventory = [];

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

              if (1 < $count) {

      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

              $table = $inventoryModel->getDataTableName();

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

           */

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

                              $value = $recordModule . '::::' . $displayValue;

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

              header('content-type: application/zip');

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

              unlink($zipName);

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

          }

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

          /**

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

          public function setTemplate(string $tplName)

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

                  ++$count;

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

                  if (\in_array($field->getType(), ['Name', 'Reference'])) {

      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 html_entity_decode($value);

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

          }

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

          }

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

              $xml->setIndent(true);

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

           *

      Line exceeds 120 characters; contains 133 characters
      Open

              $fileName = str_replace(' ', '_', \App\Purifier::decodeHtml(\App\Language::translate($this->moduleName, $this->moduleName)));

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

                  $this->tmpXmlPath = 'cache/import/' . uniqid() . '_.xml';

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

                  }

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

              $entries = [];

      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

              readfile($zipName);

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

          /**

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

           * Set template.

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

                          $value = '';

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

              $zipName = 'cache/import/' . uniqid() . '.zip';

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

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

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

              header('cache-control: post-check=0, pre-check=0', false);

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

              $addInventoryData = $this->fullData && $this->moduleInstance->isInventory();

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

           * Function returns data from advanced block.

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

           * @return array

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

          public function getEntriesInventory($recordData): array

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

          /**

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

          {

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

              header('content-type: text/csv;charset=UTF-8');

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

              readfile($this->tmpXmlPath);

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

              header("content-disposition: attachment;filename=$fileName.zip");

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

              $xml->startDocument('1.0', 'UTF-8');

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

              $fileName = str_replace(' ', '_', \App\Purifier::decodeHtml(\App\Language::translate($this->moduleName, $this->moduleName)));

      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

                      $entriesInventory = $this->getEntriesInventory($row) ?: [];

      Line exceeds 120 characters; contains 153 characters
      Open

              $dataReader = (new \App\Db\Query())->from($table)->where(['crmid' => $recordData['id']])->orderBy(['seq' => SORT_ASC])->createCommand()->query();

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

           * @param mixed  $value

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

                          $recordModule = \App\Record::getType($value);

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

                      $valueData = $field->getCurrencyParam([], $value);

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

                      $value = \App\Json::encode($valueNewData);

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

                  }

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

              header("content-disposition: attachment;filename=$fileName.xml");

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

           * @param array $entries

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

           * @return void

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

              $exportBlockName = \App\Config::component('Export', 'BLOCK_NAME');

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

           * @return $this

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

              return $this;

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

                  $this->xmlList[] = $this->tmpXmlPath;

      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())->from($table)->where(['crmid' => $recordData['id']])->orderBy(['seq' => SORT_ASC])->createCommand()->query();

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

              while ($inventoryRow = $dataReader->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

           * @param string $columnName

      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

                      $value = $field->getDisplayValue($value);

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

           *

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

                      } else {

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

                  if ('currencyparam' === $columnName) {

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

                      $valueNewData = [];

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

                      foreach ($valueData as $currencyId => &$data) {

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

              header('cache-control: post-check=0, pre-check=0', false);

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

              $zip->open($zipName, ZipArchive::CREATE);

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

              $zip->close();

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

              header('expires: Mon, 31 Dec 2000 00:00:00 GMT');

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

           * @param string $tplName

      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->tplName = $tplName;

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

          {

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

              $count = 0;

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

                      $this->createXml($this->sanitizeValues($row), $entriesInventory);

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

              } else {

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

           *

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

                          if (!empty($recordModule) && !empty($displayValue)) {

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

                      }

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

                      }

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

          public function outputFile($fileName)

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

              $zip = new ZipArchive();

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

                  $xmlFile = basename($this->xmlList[$i]);

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

                  array_shift($xmlFile);

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

              }

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

           * Create XML file.

      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 = $this->getExportQuery()->createCommand()->query();

      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->close();

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

                      if (!empty($value)) {

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

          {

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

                  $xmlFile = $fileName . $i . implode('_', $xmlFile);

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

          public function createXml($entries, $entriesInventory)

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

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

                      $value = trim($value);

      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

                  } elseif ('Currency' === $field->getType()) {

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

                          $valueNewData[$currencyName] = $data;

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

              unlink($this->tmpXmlPath);

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

              header('last-modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

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

              array_map('unlink', $this->xmlList);

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

           *

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

              $xml = new \XMLWriter();

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

                  if ($addInventoryData) {

      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

                  $this->outputZipFile($fileName);

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

           * @param array $recordData

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

                  $entries[] = $inventoryRow;

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

          public function sanitizeInventoryValue($value, $columnName): string

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

          {

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

                  }

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

          {

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

              if ($field = $this->inventoryFields[$columnName] ?? false) {

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

                  }

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

              } elseif (\in_array($columnName, ['taxparam', 'discountparam', 'currencyparam'])) {

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

                          $currencyName = \App\Fields\Currency::getById($currencyId)['currency_name'];

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

                          $data['value'] = $currencyName;

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

          }

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

                              $value = '';

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

                      $field = $this->inventoryFields['currency'];

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

              header('expires: Mon, 31 Dec 2000 00:00:00 GMT');

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

           * @param array $entriesInventory

      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

              $xml->openMemory();

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

          /** {@inheritdoc} */

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

          public function exportData()

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

                  $this->outputFile($fileName);

      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 function outputZipFile($fileName)

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

                  $zip->addFile($this->xmlList[$i], $xmlFile);

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

                              }

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

                  $xml->endElement();

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

                  return \array_key_exists($name, $customColumns);

      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 createXmlFromTemplate($entries, $entriesInventory)

      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

                      continue;

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

                      $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->getBlockName()), $this->moduleName) . '::' . $header;

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

              if ($entriesInventory) {

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

              if (($fieldModel = $this->moduleFieldInstances[$name] ?? false) && \in_array($fieldModel->getFieldDataType(), ['text', 'multiEmail'])) {

      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->get('source_field_name')) {

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

                  }

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

                              $xml->text($this->sanitizeInventoryValue($value, $columnName));

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

                      $xml->endElement();

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

          }

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

                  $xml->writeAttribute('type', $fieldModel->getFieldDataType());

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

                  $xml->writeAttribute('label', $header);

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

                      $xml->text($entries[$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

                      $xml->startElement('INVENTORY_ITEM');

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

              foreach ($this->fields as $fieldName => $fieldModel) {

      Line exceeds 120 characters; contains 143 characters
      Open

                      $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->getBlockName()), $this->moduleName) . '::' . $header;

      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 (!\in_array($columnName, $customColumns)) {

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

                          if ($this->isCData($columnName, $customColumns)) {

      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 isCData($name, $customColumns = [])

      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

                          $xml->startElement($columnName);

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

                  $xml->startElement($fieldName);

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

                      $xml->writeCData($entries[$fieldName]);

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

                  $customColumns = [];

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

                      foreach ($inventory as $columnName => $value) {

      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

                          $xml->endElement();

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

                  $xml->endElement();

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

                      }

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

                  $xml->startElement('INVENTORY_ITEMS');

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

                              $xml->writeAttribute('label', \App\Language::translate(html_entity_decode($fieldModel->get('label'), ENT_QUOTES), $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

              return false;

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

              $xml->startElement('MODULE_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

              file_put_contents($this->tmpXmlPath, $xml->flush(true), FILE_APPEND);

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

      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 ($fieldModel = ($this->inventoryFields[$columnName] ?? false)) {

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

              if ($customColumns) {

      Line exceeds 120 characters; contains 144 characters
      Open

              if (($fieldModel = $this->moduleFieldInstances[$name] ?? false) && \in_array($fieldModel->getFieldDataType(), ['text', 'multiEmail'])) {

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

                  $header = \App\Language::translate(\App\Purifier::decodeHtml($fieldModel->get('label')), $this->moduleName);

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

                  if ($this->isCData($fieldName)) {

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

                      unset($inventory['id'], $inventory['crmid']);

      Line exceeds 120 characters; contains 158 characters
      Open

                              $xml->writeAttribute('label', \App\Language::translate(html_entity_decode($fieldModel->get('label'), ENT_QUOTES), $this->moduleName));

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

                                      $customColumns[$key] = $columnName;

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

                                  }

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

                              $xml->writeCData($this->sanitizeInventoryValue($value, $columnName));

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

              $xml->endElement();

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

                  foreach ($entriesInventory as $inventory) {

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

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

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

                  }

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

      class Vtiger_ExportToXml_Model extends \App\Export\Records

      There are no issues that match your filters.

      Category
      Status