YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Function sanitizeInventoryValues has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array
    {
        ++$this->invNo;
        $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
        ++$this->colNo;
Severity: Minor
Found in modules/Vtiger/models/ExportToSpreadsheet.php - About 3 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 exportData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function exportData()
    {
        $headers = $this->getHeaders();

        $addInventoryData = $this->fullData && $this->moduleInstance->isInventory();
Severity: Minor
Found in modules/Vtiger/models/ExportToSpreadsheet.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 sanitizeInventoryValues has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array
    {
        ++$this->invNo;
        $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
        ++$this->colNo;
Severity: Minor
Found in modules/Vtiger/models/ExportToSpreadsheet.php - About 1 hr to fix

    Method putDataIntoSpreadsheet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function putDataIntoSpreadsheet(Vtiger_Field_Model $fieldModel, $value, int $id)
        {
            switch ($fieldModel->getFieldDataType()) {
                case 'integer':
                case 'double':
    Severity: Minor
    Found in modules/Vtiger/models/ExportToSpreadsheet.php - About 1 hr to fix

      Function putDataIntoSpreadsheet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function putDataIntoSpreadsheet(Vtiger_Field_Model $fieldModel, $value, int $id)
          {
              switch ($fieldModel->getFieldDataType()) {
                  case 'integer':
                  case 'double':
      Severity: Minor
      Found in modules/Vtiger/models/ExportToSpreadsheet.php - About 45 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 sanitizeInventoryValues() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
      Open

          public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array
          {
              ++$this->invNo;
              $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
              ++$this->colNo;

      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 putDataIntoSpreadsheet() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
      Open

          public function putDataIntoSpreadsheet(Vtiger_Field_Model $fieldModel, $value, int $id)
          {
              switch ($fieldModel->getFieldDataType()) {
                  case 'integer':
                  case 'double':

      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 26 to the 15 allowed.
      Open

          public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array

      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 '31', column '25').
      Open

              $this->workBook = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

      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 '86', column '21').
      Open

                      $invRows = (new \App\Db\Query())->from($inventoryTable)->where(['crmid' => $row['id']])->orderBy('seq')->all();

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

      }

      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 '\PhpOffice\PhpSpreadsheet\IOFactory' in method 'output'.
      Open

              $workbookWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->workBook, ucfirst($this->fileExtension));

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

                      } else {
                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
                      }

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

                  } else {
                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;
                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $value, $type);
                  }

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

                  } else {
                      $this->sanitizeValues($row);
                  }

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

                      } else {
                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
                      }

      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 '\PhpOffice\PhpSpreadsheet\Shared\Date' in method 'putDataIntoSpreadsheet'.
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      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 '\PhpOffice\PhpSpreadsheet\Shared\Date' in method 'putDataIntoSpreadsheet'.
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      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\Json' in method 'sanitizeInventoryValues'.
      Open

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

      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 '\PhpOffice\PhpSpreadsheet\Shared\Date' in method 'sanitizeInventoryValues'.
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

                      } else {
                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
                      }

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

              $tempFileName = tempnam(ROOT_DIRECTORY . DIRECTORY_SEPARATOR . \App\Config::main('tmp_dir'), 'xls');

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  $inventoryModel = Vtiger_Inventory_Model::getInstance($this->moduleName);

      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 unused local variables such as '$dbType'.
      Open

                  foreach ($field->getCustomColumn() as $customColumnName => $dbType) {

      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 __construct from undeclared class \PhpOffice\PhpSpreadsheet\Spreadsheet
      Open

              $this->workBook = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

      Call to method setActiveSheetIndex from undeclared class \PhpOffice\PhpSpreadsheet\Spreadsheet
      Open

              $this->workSheet = $this->workBook->setActiveSheetIndex(0);

      Call to method createWriter from undeclared class \PhpOffice\PhpSpreadsheet\IOFactory
      Open

              $workbookWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->workBook, ucfirst($this->fileExtension));

      Reference to constant TYPE_NUMERIC from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      Reference to constant TYPE_NUMERIC from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Reference to constant TYPE_NUMERIC from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

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

                      $invRows = (new \App\Db\Query())->from($inventoryTable)->where(['crmid' => $row['id']])->orderBy('seq')->all();

      Call to method PHPToExcel from undeclared class \PhpOffice\PhpSpreadsheet\Shared\Date
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

              $dataReader->close();

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $displayValue, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $field->getDisplayValue($value, $inventoryRow, true), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      Call to method PHPToExcel from undeclared class \PhpOffice\PhpSpreadsheet\Shared\Date
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $valueParam, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

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

      Call to method PHPToExcel from undeclared class \PhpOffice\PhpSpreadsheet\Shared\Date
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Reference to constant TYPE_NUMERIC from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Reference to constant TYPE_STRING from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                  $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $header, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      Reference to constant FILL_SOLID from undeclared class \PhpOffice\PhpSpreadsheet\Style\Fill
      Open

                  'fill' => ['type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'color' => ['argb' => 'E1E0F7']],

      Reference to constant TYPE_NUMERIC from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

              $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Reference to constant TYPE_NUMERIC from undeclared class \PhpOffice\PhpSpreadsheet\Cell\DataType
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

                      if ('currencyparam' === $customColumnName) {
                          $field = $inventoryFields['currency'];
                          $valueData = $field->getCurrencyParam([], $valueParam);
                          if (\is_array($valueData)) {
                              $valueNewData = [];
      Severity: Major
      Found in modules/Vtiger/models/ExportToSpreadsheet.php and 1 other location - About 1 hr to fix
      app/Export/Records.php on lines 344..355

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

      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

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

                  case 'datetime':
                      if ($value) {
                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY HH:MM:SS');
                      } else {
      Severity: Major
      Found in modules/Vtiger/models/ExportToSpreadsheet.php and 1 other location - About 1 hr to fix
      modules/Vtiger/models/ExportToSpreadsheet.php on lines 139..146

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

      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

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

                  case 'date':
                      if ($value) {
                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY');
                      } else {
      Severity: Major
      Found in modules/Vtiger/models/ExportToSpreadsheet.php and 1 other location - About 1 hr to fix
      modules/Vtiger/models/ExportToSpreadsheet.php on lines 147..154

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

      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_ExportToSpreadsheet_Model extends \App\Export\Records

      Avoid variables with short names like $fp. Configured minimum length is 3.
      Open

              $fp = fopen($tempFileName, 'r');

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

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

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          public function putDataIntoSpreadsheet(Vtiger_Field_Model $fieldModel, $value, int $id)

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

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

      The class Vtiger_ExportToSpreadsheet_Model is not named in CamelCase.
      Open

      class Vtiger_ExportToSpreadsheet_Model extends \App\Export\Records
      {
          protected $workBook;
          protected $workSheet;
          protected $headerStyles;

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

      Line exceeds 120 characters; contains 156 characters
      Open

                  $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $header, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

              ++$this->rowNo;

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

              $this->workBook = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

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

                  'font' => ['bold' => true],

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

          public function output($headers, $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

          protected $colNo = 1;

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

              //having written out all the data lets have a go at getting the columns to auto-size

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

                  ++$col;

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

              $tempFileName = tempnam(ROOT_DIRECTORY . DIRECTORY_SEPARATOR . \App\Config::main('tmp_dir'), 'xls');

      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

              $length = \count($headers);

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

                  $cell = $this->workSheet->getCellByColumnAndRow($col, $row);

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

              unlink($tempFileName);

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

          protected $workBook;

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

          protected $invNo = 0;

      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

           */

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

              $this->workSheet = $this->workBook->setActiveSheetIndex(0);

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

          public function getHeaders(): array

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

              $headers = parent::getHeaders();

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

              fclose($fp);

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

          protected $workSheet;

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

              ];

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

          /** {@inheritdoc} */

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

                  ++$this->colNo;

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

              $workbookWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->workBook, ucfirst($this->fileExtension));

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

              $this->headerStyles = [

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

                  $this->workSheet->getStyleByColumnAndRow($col, $row)->applyFromArray($this->headerStyles);

      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->sanitizeValues($row);

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

              $this->output($headers, []);

      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->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $displayValue, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_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

                          $field = $inventoryFields['currency'];

      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

              }

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

          public function __construct()

      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->putDataIntoSpreadsheet($fieldModel, $row[$dbKey], $row[$idKey] ?? 0);

      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

           *

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

                  case 'integer':

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

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

                  default:

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

          }

      Line exceeds 120 characters; contains 205 characters
      Open

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $field->getDisplayValue($value, $inventoryRow, true), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_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

              parent::__construct();

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

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

              fpassthru($fp);

      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

              $this->colNo = 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

           * @return void

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

                      if ($value) {

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

              ++$this->invNo;

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

                  $value = $inventoryRow[$columnName] ?? '';

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

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

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

      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

                              $valueParam = \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

                  $this->workSheet->getColumnDimension($cell->getColumn())->setAutoSize(true);

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

              }

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

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      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->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_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

          /** {@inheritdoc} */

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

          public function sanitizeInventoryValues(array $inventoryRow, array $inventoryFields): array

      Line exceeds 120 characters; contains 154 characters
      Open

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      Line exceeds 120 characters; contains 164 characters
      Open

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $valueParam, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      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

          {

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

                  case 'double':

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

                  case 'datetime':

      Line exceeds 120 characters; contains 146 characters
      Open

                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY HH:MM:SS');

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

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $field->getDisplayValue($value, $inventoryRow, true), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_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

          public function exportData()

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

                      if ($invRows) {

      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

                  $idKey = 'id';

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

                      $name = $fieldModel->get('source_field_name') . $fieldModel->getModuleName();

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

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $value, $type);

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

                  case 'date':

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

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

              foreach ($inventoryFields as $columnName => $field) {

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

                  ++$this->colNo;

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

                      }

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

              return [];

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

                  'fill' => ['type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'color' => ['argb' => 'E1E0F7']],

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

          {

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

          /** {@inheritdoc} */

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

              for ($i = 1; $i <= $length; ++$i) {

      Line exceeds 120 characters; contains 127 characters
      Open

                      $invRows = (new \App\Db\Query())->from($inventoryTable)->where(['crmid' => $row['id']])->orderBy('seq')->all();

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

                              $this->sanitizeInventoryValues($invRow, $inventoryFields);

      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 sanitizeValues(array $row): array

      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

                      } else {

      Line exceeds 120 characters; contains 159 characters
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

              ++$this->colNo;

      Line exceeds 120 characters; contains 215 characters
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY');

      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

                  $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $header, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

                      $idKey = $name . $idKey;

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

              $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

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

      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

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $valueParam, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

              $row = $col = 1;

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

              $headers = $this->getHeaders();

      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

                      $invRows = (new \App\Db\Query())->from($inventoryTable)->where(['crmid' => $row['id']])->orderBy('seq')->all();

      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

           * Put data into spread sheet.

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

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Line exceeds 120 characters; contains 137 characters
      Open

                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY');

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

                      ++$this->colNo;

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

          protected $rowNo = 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

              foreach ($headers as $header) {

      Line exceeds 120 characters; contains 124 characters
      Open

              $workbookWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->workBook, ucfirst($this->fileExtension));

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

              $workbookWriter->save($tempFileName);

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

              $fp = fopen($tempFileName, 'r');

      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

                  if ($addInventoryData) {

      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

          {

      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->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY HH:MM:SS');

      Line exceeds 120 characters; contains 158 characters
      Open

              $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $this->invNo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

          public function putDataIntoSpreadsheet(Vtiger_Field_Model $fieldModel, $value, int $id)

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

                      if ($value) {

      Line exceeds 120 characters; contains 166 characters
      Open

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $displayValue, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

      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

                      $valueParam = $inventoryRow[$customColumnName] ?? '';

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

                  $inventoryTable = $inventoryModel->getDataTableName();

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

                      $this->sanitizeValues($row);

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

           * @param Vtiger_Field_Model $fieldModel

      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

                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY');

      Line exceeds 120 characters; contains 159 characters
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

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

              ++$this->colNo;

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

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      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

                  $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

                      $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, $value, $type);

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

                  foreach ($field->getCustomColumn() as $customColumnName => $dbType) {

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

                              }

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

                          }

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

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

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

              return [];

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

           * @param int                $id

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

           */

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

                  case 'currency':

      Line exceeds 120 characters; contains 215 characters
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

                          }

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

                          foreach ($invRows as $invRow) {

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

                  }

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

              switch ($fieldModel->getFieldDataType()) {

      Line exceeds 120 characters; contains 154 characters
      Open

                      $type = is_numeric($value) ? \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC : \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING;

      Line exceeds 120 characters; contains 215 characters
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

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

                      break;

      Line exceeds 120 characters; contains 177 characters
      Open

                  if (\in_array($field->getType(), ['Name', 'Reference', 'Currency', 'Value', 'Unit', 'Boolean', 'Comment', 'Picklist', 'PicklistField', 'DiscountMode', 'TaxMode'])) {

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

                          if (\is_array($valueData)) {

      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

                      $dbKey = $name . $fieldModel->getName();

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

              ++$this->rowNo;

      Line exceeds 120 characters; contains 137 characters
      Open

                          $this->workSheet->getStyleByColumnAndRow($this->colNo, $this->rowNo)->getNumberFormat()->setFormatCode('DD/MM/YYYY');

      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

                      }

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

                      $displayValue = $this->getDisplayValue($fieldModel, $value, $id, []) ?: '';

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

                  if (\in_array($field->getType(), ['Name', 'Reference', 'Currency', 'Value', 'Unit', 'Boolean', 'Comment', 'Picklist', 'PicklistField', 'DiscountMode', 'TaxMode'])) {

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

                      if ($value) {

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

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($value), \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);

      Line exceeds 120 characters; contains 159 characters
      Open

                          $this->workSheet->setCellValueExplicitByColumnAndRow($this->colNo, $this->rowNo, '', \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_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

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

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

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

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

      class Vtiger_ExportToSpreadsheet_Model extends \App\Export\Records

      There are no issues that match your filters.

      Category
      Status