YetiForceCompany/YetiForceCRM

View on GitHub
vtlib/Vtiger/PackageExport.php

Summary

Maintainability
F
1 wk
Test Coverage
D
67%

File PackageExport.php has 624 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/* +**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
Severity: Major
Found in vtlib/Vtiger/PackageExport.php - About 1 day to fix

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

        public function exportRelatedLists(ModuleBasic $moduleInstance)
        {
            if (!$moduleInstance->isentitytype) {
                return;
            }
    Severity: Minor
    Found in vtlib/Vtiger/PackageExport.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 exportFields has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function exportFields(ModuleBasic $moduleInstance, $blockid)
        {
            $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
            if (0 === $dataReader->count()) {
                return;
    Severity: Minor
    Found in vtlib/Vtiger/PackageExport.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

    Method exportFields has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function exportFields(ModuleBasic $moduleInstance, $blockid)
        {
            $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
            if (0 === $dataReader->count()) {
                return;
    Severity: Major
    Found in vtlib/Vtiger/PackageExport.php - About 4 hrs to fix

      The class PackageExport has 23 public methods. Consider refactoring PackageExport to keep number of public methods under 10.
      Open

      class PackageExport
      {
          public $_export_tmpdir = 'cache/vtlib';
          public $_export_modulexml_filename;
          public $_export_modulexml_file;
      Severity: Minor
      Found in vtlib/Vtiger/PackageExport.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

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

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

      class PackageExport
      {
          public $_export_tmpdir = 'cache/vtlib';
          public $_export_modulexml_filename;
          public $_export_modulexml_file;
      Severity: Minor
      Found in vtlib/Vtiger/PackageExport.php by phpmd

      Method export has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
          {
              $this->zipFileName = $zipFileName;
              $this->moduleInstance = $moduleInstance;
              $module = $this->moduleInstance->name;
      Severity: Major
      Found in vtlib/Vtiger/PackageExport.php - About 3 hrs to fix

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

            public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
            {
                $this->zipFileName = $zipFileName;
                $this->moduleInstance = $moduleInstance;
                $module = $this->moduleInstance->name;
        Severity: Minor
        Found in vtlib/Vtiger/PackageExport.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

        Method exportRelatedLists has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function exportRelatedLists(ModuleBasic $moduleInstance)
            {
                if (!$moduleInstance->isentitytype) {
                    return;
                }
        Severity: Major
        Found in vtlib/Vtiger/PackageExport.php - About 3 hrs to fix

          PackageExport has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class PackageExport
          {
              public $_export_tmpdir = 'cache/vtlib';
              public $_export_modulexml_filename;
              public $_export_modulexml_file;
          Severity: Minor
          Found in vtlib/Vtiger/PackageExport.php - About 2 hrs to fix

            Method exportCustomViews has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function exportCustomViews(ModuleBasic $moduleInstance)
                {
                    $customViewDataReader = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])
                        ->createCommand()->query();
                    if (!$customViewDataReader->count()) {
            Severity: Minor
            Found in vtlib/Vtiger/PackageExport.php - About 1 hr to fix

              Method exportModule has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function exportModule()
                  {
                      $moduleId = $this->moduleInstance->id;
                      $row = (new \App\Db\Query())
                          ->select(['name', 'tablabel', 'version', 'type', 'premium'])
              Severity: Minor
              Found in vtlib/Vtiger/PackageExport.php - About 1 hr to fix

                Function exportSharingAccess has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function exportSharingAccess(ModuleBasic $moduleInstance)
                    {
                        $permission = (new \App\Db\Query())->select(['permission'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->column();
                        if (empty($permission)) {
                            return;
                Severity: Minor
                Found in vtlib/Vtiger/PackageExport.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 exportSharingAccess has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function exportSharingAccess(ModuleBasic $moduleInstance)
                    {
                        $permission = (new \App\Db\Query())->select(['permission'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->column();
                        if (empty($permission)) {
                            return;
                Severity: Minor
                Found in vtlib/Vtiger/PackageExport.php - About 1 hr to fix

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

                      public function exportCustomViews(ModuleBasic $moduleInstance)
                      {
                          $customViewDataReader = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])
                              ->createCommand()->query();
                          if (!$customViewDataReader->count()) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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

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

                      public function exportDependencies(ModuleBasic $moduleInstance)
                      {
                          $moduleId = $moduleInstance->id;
                          $minVersion = \App\Version::get();
                          $maxVersion = false;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php - About 25 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                      public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
                      {
                          $this->zipFileName = $zipFileName;
                          $this->moduleInstance = $moduleInstance;
                          $module = $this->moduleInstance->name;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  The method export() has an NPath complexity of 18432. The configured NPath complexity threshold is 200.
                  Open

                      public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
                      {
                          $this->zipFileName = $zipFileName;
                          $this->moduleInstance = $moduleInstance;
                          $module = $this->moduleInstance->name;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  NPathComplexity

                  Since: 0.1

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

                  Example

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

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

                  The method exportFields() has an NPath complexity of 3586. The configured NPath complexity threshold is 200.
                  Open

                      public function exportFields(ModuleBasic $moduleInstance, $blockid)
                      {
                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
                          if (0 === $dataReader->count()) {
                              return;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  NPathComplexity

                  Since: 0.1

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

                  Example

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

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

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

                      public function exportFields(ModuleBasic $moduleInstance, $blockid)
                      {
                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
                          if (0 === $dataReader->count()) {
                              return;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  The method exportRelatedLists() has an NPath complexity of 242. The configured NPath complexity threshold is 200.
                  Open

                      public function exportRelatedLists(ModuleBasic $moduleInstance)
                      {
                          if (!$moduleInstance->isentitytype) {
                              return;
                          }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  NPathComplexity

                  Since: 0.1

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

                  Example

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

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

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

                      public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
                      {
                          $this->zipFileName = $zipFileName;
                          $this->moduleInstance = $moduleInstance;
                          $module = $this->moduleInstance->name;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 exportFields() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                  Open

                      public function exportFields(ModuleBasic $moduleInstance, $blockid)
                      {
                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
                          if (0 === $dataReader->count()) {
                              return;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 exportRelatedLists() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                  Open

                      public function exportRelatedLists(ModuleBasic $moduleInstance)
                      {
                          if (!$moduleInstance->isentitytype) {
                              return;
                          }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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

                  Class "PackageExport" has 24 methods, which is greater than 20 authorized. Split it into smaller classes.
                  Open

                  class PackageExport
                  Severity: Major
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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

                      public function exportRelatedLists(ModuleBasic $moduleInstance)
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.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 23 to the 15 allowed.
                  Open

                      public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                  See

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

                      public function exportFields(ModuleBasic $moduleInstance, $blockid)
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.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

                  The class PackageExport has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13.
                  Open

                  class PackageExport
                  {
                      public $_export_tmpdir = 'cache/vtlib';
                      public $_export_modulexml_filename;
                      public $_export_modulexml_file;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CouplingBetweenObjects

                  Since: 1.1.0

                  A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                  Example

                  class Foo {
                      /**
                       * @var \foo\bar\X
                       */
                      private $x = null;
                  
                      /**
                       * @var \foo\bar\Y
                       */
                      private $y = null;
                  
                      /**
                       * @var \foo\bar\Z
                       */
                      private $z = null;
                  
                      public function setFoo(\Foo $foo) {}
                      public function setBar(\Bar $bar) {}
                      public function setBaz(\Baz $baz) {}
                  
                      /**
                       * @return \SplObjectStorage
                       * @throws \OutOfRangeException
                       * @throws \InvalidArgumentException
                       * @throws \ErrorException
                       */
                      public function process(\Iterator $it) {}
                  
                      // ...
                  }

                  Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

                          $dataReader = (new \App\Db\Query())->from(\Vtiger_Inventory_Model::getInstance($this->moduleInstance->name)->getTableName())->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '627', column '22').
                  Open

                          $dataReader = (new \App\Db\Query())->select(['actionname'])->from('vtiger_profile2utility')->innerJoin('vtiger_actionmapping', 'vtiger_profile2utility.activityid = vtiger_actionmapping.actionid')->where(['tabid' => $moduleInstance->id])->distinct('actionname')->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '652', column '22').
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['tabid' => $moduleId])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '423', column '22').
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  MissingImport

                  Since: 2.7.0

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

                  Example

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

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

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

                      public function closeNode($node, $delimiter = PHP_EOL, $space = true)
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  BooleanArgumentFlag

                  Since: 1.4.0

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

                  Example

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

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

                  Missing class import via use statement (line '480', column '28').
                  Open

                                  $fieldRelModule = (new \App\Db\Query())->select(['relmodule'])->from('vtiger_fieldmodulerel')->where(['fieldid' => $row['fieldid']])->column();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '249', column '47').
                  Open

                          foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator('languages', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '268', column '22').
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_tab_info')->where(['tabid' => $moduleId])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '508', column '28').
                  Open

                                      $dataReaderRow = (new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => $fieldParams])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '559', column '31').
                  Open

                              $cvColumnDataReader = (new \App\Db\Query())->from('vtiger_cvcolumnlist')->where(['cvid' => $cvid])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '690', column '25').
                  Open

                          $dataReaderRow = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['related_tabid' => $moduleId])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '391', column '22').
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_blocks')->where(['tabid' => $moduleInstance->id])->orderBy(['sequence' => SORT_ASC])->createCommand()->query();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '295', column '15').
                  Open

                          $row = (new \App\Db\Query())
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '155', column '14').
                  Open

                              throw new \App\Exceptions\AppException('File already exists: ' . $this->zipFileName);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '427', column '23').
                  Open

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '538', column '32').
                  Open

                          $customViewDataReader = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  MissingImport

                  Since: 2.7.0

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

                  Example

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

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

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

                      public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  BooleanArgumentFlag

                  Since: 1.4.0

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

                  Example

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

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

                  Missing class import via use statement (line '249', column '16').
                  Open

                          foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator('languages', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '504', column '24').
                  Open

                                  $treesExist = (new \App\Db\Query())->select(['name', 'access'])->from('vtiger_trees_templates')->where(['templateid' => $fieldParams])->one();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '588', column '22').
                  Open

                          $permission = (new \App\Db\Query())->select(['permission'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->column();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                          if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}")) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                          if (file_exists('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png")) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 exportModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                  Open

                          } else {
                              $type = 'entity';
                          }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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_Viewer' in method 'export'.
                  Open

                              $zip->addFile('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png", "$module.png");
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '714', column '9').
                  Open

                      public function exportRelatedLists(ModuleBasic $moduleInstance)
                      {
                          if (!$moduleInstance->isentitytype) {
                              return;
                          }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Zip' in method 'export'.
                  Open

                          $zip = \App\Zip::createFile($this->zipFileName);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class 'vtlib\Utils' in method '__initExport'.
                  Open

                              Utils::checkFileAccessForInclusion("modules/$module/$module.php");
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 export uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                  Open

                          } else {
                              $zip->close();
                              if ($todir) {
                                  copy($this->zipFileName, $todir);
                              }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 assigning values to variables in if clauses and the like (line '370', column '19').
                  Open

                      public function exportTables()
                      {
                          $modulename = $this->moduleInstance->name;
                          $this->openNode('tables');
                  
                  
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Field' in method 'exportRelatedLists'.
                  Open

                                  if ($fields = \App\Field::getFieldsFromRelation($row['relation_id'])) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                                  'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}",
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                                  'public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}/resources",
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '\CRMEntity' in method 'exportTables'.
                  Open

                              $focus = \CRMEntity::getInstance($modulename);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class 'vtlib\Cron' in method 'exportCronTasks'.
                  Open

                          $cronTasks = Cron::listAllInstancesByModule($moduleInstance->name);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                              if ($layoutName != 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName()) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '676', column '9').
                  Open

                      public function exportRelatedLists(ModuleBasic $moduleInstance)
                      {
                          if (!$moduleInstance->isentitytype) {
                              return;
                          }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '\Vtiger_Viewer' in method 'export'.
                  Open

                          if (is_dir('public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}/resources")) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Version' in method 'exportDependencies'.
                  Open

                          $minVersion = \App\Version::get();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 'exportTables'.
                  Open

                                  $this->outputNode('<![CDATA[' . \App\Purifier::decodeHtml($createTable['Create Table']) . ']]>', 'sql');
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                          if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}")) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Fields\RecordNumber' in method 'exportFields'.
                  Open

                                  $valueFieldNumber = \App\Fields\RecordNumber::getInstance($moduleInstance->id);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                          if (is_dir('public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}/resources")) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\CustomView' in method 'exportCustomViews'.
                  Open

                              $rules = \App\CustomView::getConditions($cvid);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Field' in method 'exportRelatedLists'.
                  Open

                                  if ($fields = \App\Field::getFieldsFromRelation($row['relation_id'])) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                                  'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}",
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  StaticAccess

                  Since: 1.4.0

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

                  Example

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

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

                  Avoid using static access to class '\Vtiger_Viewer' in method 'export'.
                  Open

                                  'public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}/resources",
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 '\VtlibUtils' in method 'exportTables'.
                  Open

                              \VtlibUtils::vtlibSetupModulevars($modulename, $focus);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Fields\Picklist' in method 'exportFields'.
                  Open

                                  foreach (\App\Fields\Picklist::getValuesName($fieldname) as $picklistvalue) {
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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\Json' in method 'exportCustomViews'.
                  Open

                                  $this->outputNode('<![CDATA[' . \App\Json::encode($rules) . ']]>', 'rules');
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.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 "actions" 8 times.
                  Open

                              $this->openNode('actions');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "fields" 10 times.
                  Open

                          $this->openNode('fields');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "entityidfield" 3 times.
                  Open

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                              $this->outputNode($row['displaytype'], 'displaytype');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "summaryfield" 3 times.
                  Open

                              if (isset($row['summaryfield'])) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                              $fieldParams = $row['fieldparams'];
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "presence" 10 times.
                  Open

                              $this->outputNode($row['presence'], 'presence');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "access" 3 times.
                  Open

                                  $treesExist = (new \App\Db\Query())->select(['name', 'access'])->from('vtiger_trees_templates')->where(['templateid' => $fieldParams])->one();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                                  $this->outputNode($row['relation_comment'], 'relation_comment');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "sequence" 15 times.
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_blocks')->where(['tabid' => $moduleInstance->id])->orderBy(['sequence' => SORT_ASC])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "description" 3 times.
                  Open

                              $this->outputNode('<![CDATA[' . $row['description'] . ']]>', 'description');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                                  $this->outputNode($cvRow['field_name'], 'fieldname');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                              $columnName = $row['columnname'];
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                          $this->outputNode($row['tablabel'], 'label');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                                  $this->openNode('action');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                              $this->openNode('block');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "field" 8 times.
                  Open

                              $this->openNode('field');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "entityidcolumn" 3 times.
                  Open

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                              $this->outputNode($row['defaultvalue'], 'defaultvalue');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                                  $this->outputNode($row['view_type'], 'view_type');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "<![CDATA[" 4 times.
                  Open

                                  $this->outputNode('<![CDATA[' . \App\Purifier::decodeHtml($createTable['Create Table']) . ']]>', 'sql');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "inventory" 3 times.
                  Open

                              $type = 'inventory';
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                                  $this->outputNode($row['favorites'], 'favorites');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "layouts/" 7 times.
                  Open

                          if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}")) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "tabid" 9 times.
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_tab_info')->where(['tabid' => $moduleId])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "version" 3 times.
                  Open

                              ->select(['name', 'tablabel', 'version', 'type', 'premium'])
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "premium" 3 times.
                  Open

                              ->select(['name', 'tablabel', 'version', 'type', 'premium'])
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "public_html/layouts/" 4 times.
                  Open

                          if (is_dir('public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}/resources")) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "actionname" 3 times.
                  Open

                          $dataReader = (new \App\Db\Query())->select(['actionname'])->from('vtiger_profile2utility')->innerJoin('vtiger_actionmapping', 'vtiger_profile2utility.activityid = vtiger_actionmapping.actionid')->where(['tabid' => $moduleInstance->id])->distinct('actionname')->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Define a constant instead of duplicating this literal "masseditable" 3 times.
                  Open

                              if (isset($row['masseditable'])) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

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

                                  $this->outputNode($row['creator_detail'], 'creator_detail');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by sonar-php

                  Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                  On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                  Noncompliant Code Example

                  With the default threshold of 3:

                  function run() {
                    prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                    execute('action1');
                    release('action1');
                  }
                  

                  Compliant Solution

                  ACTION_1 = 'action1';
                  
                  function run() {
                    prepare(ACTION_1);
                    execute(ACTION_1);
                    release(ACTION_1);
                  }
                  

                  Exceptions

                  To prevent generating some false-positives, literals having less than 5 characters are excluded.

                  Reference to undeclared property \CRMEntity->tab_name
                  Open

                              $tables = $focus->tab_name;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \vtlib\PackageExport::getName
                  Open

                              $this->outputNode($cronTask->getName(), 'name');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                                      $dataReaderRow = (new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => $fieldParams])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $customViewDataReader = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \vtlib\PackageExport::getDescription
                  Open

                              $this->outputNode($cronTask->getDescription(), 'description');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_blocks')->where(['tabid' => $moduleInstance->id])->orderBy(['sequence' => SORT_ASC])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          $dataReader = (new \App\Db\Query())->from(\Vtiger_Inventory_Model::getInstance($this->moduleInstance->name)->getTableName())->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          $module = $this->moduleInstance->name;
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          $moduleId = $this->moduleInstance->id;
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $row = (new \App\Db\Query())
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportSharingAccess() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:586
                  Open

                          $this->exportSharingAccess($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          if ($this->moduleInstance->isentitytype) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReaderRow = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['related_tabid' => $moduleId])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \vtlib\PackageExport::getHandlerClass
                  Open

                              $this->outputNode($cronTask->getHandlerClass(), 'handler');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          if ($this->moduleInstance->isentitytype) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                              $this->zipFileName = $this->moduleInstance->name . '_' . date('Y-m-d-Hi') . '_' . $this->moduleInstance->version . '.zip';
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                                  $fieldRelModule = (new \App\Db\Query())->select(['relmodule'])->from('vtiger_fieldmodulerel')->where(['fieldid' => $row['fieldid']])->column();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['tabid' => $moduleId])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \App\Db::createCommand
                  Open

                                  $createTable = \App\Db::getInstance()->createCommand('SHOW CREATE TABLE ' . $table)->queryOne();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                                  $treesExist = (new \App\Db\Query())->select(['name', 'access'])->from('vtiger_trees_templates')->where(['templateid' => $fieldParams])->one();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReader = (new \App\Db\Query())->select(['actionname'])->from('vtiger_profile2utility')->innerJoin('vtiger_actionmapping', 'vtiger_profile2utility.activityid = vtiger_actionmapping.actionid')->where(['tabid' => $moduleInstance->id])->distinct('actionname')->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleName) is false but \vtlib\Cron::listAllInstancesByModule() takes string defined at /code/vtlib/Vtiger/Cron.php:495
                  Open

                          $cronTasks = Cron::listAllInstancesByModule($moduleInstance->name);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportCronTasks() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:759
                  Open

                          $this->exportCronTasks($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportActions() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:622
                  Open

                          $this->exportActions($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportCustomLinks() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:733
                  Open

                          $this->exportCustomLinks($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $permission = (new \App\Db\Query())->select(['permission'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->column();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_tab_info')->where(['tabid' => $moduleId])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          if (!$this->moduleInstance->isentitytype) {
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportRelatedLists() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:646
                  Open

                          $this->exportRelatedLists($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Assigning null to property but \vtlib\PackageExport->_export_modulexml_file is false|resource
                  Open

                              $this->_export_modulexml_file = null;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportBlocks() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:389
                  Open

                          $this->exportBlocks($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Expected an object instance when accessing an instance property, but saw an expression with type false
                  Open

                          $modulename = $this->moduleInstance->name;
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \vtlib\PackageExport::getSequence
                  Open

                              $this->outputNode($cronTask->getSequence(), 'sequence');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Assigning \vtlib\Module to property but \vtlib\PackageExport->moduleInstance is false
                  Open

                          $this->moduleInstance = $moduleInstance;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportDependencies() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:263
                  Open

                          $this->exportDependencies($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Argument 1 (moduleInstance) is false but \vtlib\PackageExport::exportCustomViews() takes \vtlib\ModuleBasic defined at /code/vtlib/Vtiger/PackageExport.php:536
                  Open

                          $this->exportCustomViews($this->moduleInstance);
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \App\Db::getTableSchema
                  Open

                              $infoSchema = \App\Db::getInstance()->getTableSchema($tableName);
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to method getInstance from undeclared class \App\Fields\RecordNumber (Did you mean class \Tests\Base\RecordNumber)
                  Open

                                  $valueFieldNumber = \App\Fields\RecordNumber::getInstance($moduleInstance->id);
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                              $cvColumnDataReader = (new \App\Db\Query())->from('vtiger_cvcolumnlist')->where(['cvid' => $cvid])->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \vtlib\PackageExport::getFrequency
                  Open

                              $this->outputNode($cronTask->getFrequency(), 'frequency');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          $dataReader = (new \App\Db\Query())->from(\Vtiger_Inventory_Model::getInstance($this->moduleInstance->name)->getTableName())->createCommand()->query();
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

                  Call to undeclared method \vtlib\PackageExport::getStatus
                  Open

                              $this->outputNode($cronTask->getStatus(), 'status');
                  Severity: Critical
                  Found in vtlib/Vtiger/PackageExport.php by phan

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

                          if ($dataReader->count()) {
                              $this->openNode('relatedlists');
                              while ($row = $dataReader->read()) {
                                  $this->openNode('relatedlist');
                                  $this->outputNode(Module::getInstance($row['related_tabid'])->name, 'relatedmodule');
                  Severity: Major
                  Found in vtlib/Vtiger/PackageExport.php and 1 other location - About 1 day to fix
                  vtlib/Vtiger/PackageExport.php on lines 691..725

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

                  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

                          if ($dataReaderRow->count()) {
                              $this->openNode('inrelatedlists');
                              while ($row = $dataReaderRow->read()) {
                                  $this->openNode('inrelatedlist');
                                  $this->outputNode(Module::getInstance($row['tabid'])->name, 'inrelatedmodule');
                  Severity: Major
                  Found in vtlib/Vtiger/PackageExport.php and 1 other location - About 1 day to fix
                  vtlib/Vtiger/PackageExport.php on lines 653..687

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

                  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

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

                      public $_export_modulexml_filename;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  LongVariable

                  Since: 0.2

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

                  Example

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

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

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

                      public $_export_modulexml_file;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  LongVariable

                  Since: 0.2

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

                  Example

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

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

                  The property $_export_tmpdir is not named in camelCase.
                  Open

                  class PackageExport
                  {
                      public $_export_tmpdir = 'cache/vtlib';
                      public $_export_modulexml_filename;
                      public $_export_modulexml_file;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCasePropertyName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      protected $property_name;
                  }

                  Source

                  The property $_export_modulexml_filename is not named in camelCase.
                  Open

                  class PackageExport
                  {
                      public $_export_tmpdir = 'cache/vtlib';
                      public $_export_modulexml_filename;
                      public $_export_modulexml_file;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCasePropertyName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      protected $property_name;
                  }

                  Source

                  The property $_export_modulexml_file is not named in camelCase.
                  Open

                  class PackageExport
                  {
                      public $_export_tmpdir = 'cache/vtlib';
                      public $_export_modulexml_filename;
                      public $_export_modulexml_file;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCasePropertyName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      protected $property_name;
                  }

                  Source

                  Property name "$_export_modulexml_filename" should not be prefixed with an underscore to indicate visibility
                  Open

                      public $_export_modulexml_filename;

                  Property name "$_export_modulexml_file" should not be prefixed with an underscore to indicate visibility
                  Open

                      public $_export_modulexml_file;

                  Property name "$_export_tmpdir" should not be prefixed with an underscore to indicate visibility
                  Open

                      public $_export_tmpdir = 'cache/vtlib';

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

                          $pre = '';

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

                          $pre = '';

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

                              $pre = str_repeat("\t", $this->openNode);

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

                          if ('' != $node) {

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

                          }

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

                          fwrite($this->_export_modulexml_file, $value ?? '');

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

                      public function __getManifestFilePath()

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

                          if (empty($this->_export_modulexml_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

                          if (false === is_dir($this->_export_tmpdir)) {

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

                      /** Output Handlers */

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

                      public function closeNode($node, $delimiter = PHP_EOL, $space = true)

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

                          $this->__write($pre . "</$node>$delimiter");

                  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->_export_modulexml_file = fopen($this->__getManifestFilePath(), 'w');

                  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

                      /**

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

                      public $_export_tmpdir = 'cache/vtlib';

                  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->closeNode($node, PHP_EOL, false);

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

                       * Post export work.

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

                              mkdir($this->_export_tmpdir, 0755);

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

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

                       * Constructor.

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

                      public function outputNode($value, $node = '')

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

                          $this->__write($value);

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

                      public function __write($value)

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

                          return "$this->_export_tmpdir/$this->_export_modulexml_filename";

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

                       * @param mixed $module

                  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

                              Utils::checkFileAccessForInclusion("modules/$module/$module.php");

                  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

                              $pre = str_repeat("\t", $this->openNode);

                  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

                       * Initialize Export.

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

                              // We will be including the file, so do a security check.

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

                       */

                  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 ('' === $delimiter || PHP_EOL === $delimiter) {

                  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 the module xml filename to be written for exporting.

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

                          if ($this->moduleInstance->isentitytype) {

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

                      /**

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

                          // Call module export function

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

                              $this->zipFileName = $this->moduleInstance->name . '_' . date('Y-m-d-Hi') . '_' . $this->moduleInstance->version . '.zip';

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

                                  }

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

                          // Copy config files

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

                              $zip->download($module);

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

                       * @param \App\Zip $zip

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

                                  $zip->addFile($filePath, $zipPath);

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

                       * Set the module.xml file path for this export and

                  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 __initExport($module)

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

                      public $_export_modulexml_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

                      {

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

                              $this->openNode($node, '');

                  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

                      public function __finishExport()

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

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

                      {

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

                              unlink($this->__getManifestFilePath());

                  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

                              $zip->addDirectory(

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

                                  true

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

                                  true

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

                              if ($layoutName != 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName()) {

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

                          if ($directDownload) {

                  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

                              if ($todir) {

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

                          $this->__cleanupExport();

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

                                  $zipPath = str_replace(\DIRECTORY_SEPARATOR, '/', $item->getPath() . \DIRECTORY_SEPARATOR . $item->getFilename());

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

                      private $zipFileName;

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

                          if ($space) {

                  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 its temporary path.

                  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->_export_modulexml_filename = 'manifest-' . time() . '.xml';

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

                          $this->__write("<?xml version='1.0'?>\n");

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

                          if (!empty($this->_export_modulexml_file)) {

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

                          return $this->zipFileName;

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

                       * @param string        $todir          Output directory path

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

                          $this->__initExport($module);

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

                          if (file_exists($this->zipFileName)) {

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

                          $zip->addDirectory("modules/$module");

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

                                  'templates',

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

                                  'settings/public_resources',

                  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

                                  copy($this->zipFileName, $todir);

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

                      private $openNode = 0;

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

                      }

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

                      public function openNode($node, $delimiter = PHP_EOL)

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

                          $this->__write($pre . "<$node>$delimiter");

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

                          ++$this->openNode;

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

                          if ('' != $node) {

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

                       * Clean up the temporary files created.

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

                          }

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

                              throw new \App\Exceptions\AppException('File already exists: ' . $this->zipFileName);

                  Line exceeds 120 characters; contains 128 characters
                  Open

                          if (is_dir('public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}/resources")) {

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

                          foreach ($layoutDirectories as $layoutName) {

                  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

                          $moduleId = $this->moduleInstance->id;

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

                          $this->outputNode($row['tablabel'], 'label');

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

                              $this->outputNode($tabVersion, 'version');

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

                          $this->exportCronTasks($this->moduleInstance);

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

                      }

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

                       * Export module blocks with its related fields.

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

                          if (0 === $dataReader->count()) {

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

                              $this->_export_modulexml_file = null;

                  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

                          // Copy module directory

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

                          if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}")) {

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

                              );

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

                          //Copy module public Settings resources files

                  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->__copyLanguageFiles($zip, $module);

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

                              $zip->addFile('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png", "$module.png");

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

                              if ('vtiger_min_version' == $prefName) {

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

                              if ('vtiger_max_version' == $prefName) {

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

                       * Export Module Handler.

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

                          $row = (new \App\Db\Query())

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

                          $tabVersion = $row['version'] ?? false;

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

                          $this->openNode('module');

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

                              $type = 'inventory';

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

                          // Export module tables

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

                          $this->closeNode('module');

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

                              $this->exportFields($moduleInstance, $row['blockid']);

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

                              fclose($this->_export_modulexml_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

                      public function export(Module $moduleInstance, $todir = '', $zipFileName = '', $directDownload = false)

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

                          $zip->addFile($this->__getManifestFilePath(), 'manifest.xml');

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

                                  'settings/modules',

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

                          if (is_dir("cron/modules/{$module}")) {

                  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 (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}")) {

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

                          if (is_dir('public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}/resources")) {

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

                                  if (is_dir($settingsLayout)) {

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

                          //Copy image file

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

                      }

                  Line exceeds 120 characters; contains 130 characters
                  Open

                                  $zipPath = str_replace(\DIRECTORY_SEPARATOR, '/', $item->getPath() . \DIRECTORY_SEPARATOR . $item->getFilename());

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

                       * Export vtiger dependencies.

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

                              $this->outputNode($maxVersion, 'vtiger_max_version');

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

                  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 __cleanupExport()

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

                       * @param string        $zipFileName    Zipfilename to use

                  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 bool          $directDownload True for sending the output as download

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

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

                       */

                  Line exceeds 120 characters; contains 122 characters
                  Open

                                  'public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}/resources",

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

                          $this->__finishExport();

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

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

                              }

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

                          // Copy Settings/module directory

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

                      }

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

                              $zip->addDirectory(

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

                       *

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

                          //Copy Settings module templates files, if any

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_tab_info')->where(['tabid' => $moduleId])->createCommand()->query();

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

                                  'settings/templates',

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

                              $prefName = $row['prefname'];

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

                          //Copy module public resources files

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

                                  $maxVersion = $prefValue;

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

                          if (is_dir('public_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}/resources")) {

                  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_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}/resources",

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

                      public function exportModule()

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

                                      $zip->addDirectory($moduleLayout, $moduleLayout);

                  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

                          //Export cronTasks

                  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->openNode('tables');

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

                          $this->closeNode('dependencies');

                  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->outputNode($row['create_view'], 'create_view');

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

                          // Export dependency information

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

                       * Export fields related to a module block.

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

                          // Export Sharing Access

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

                       * @param ModuleBasic $moduleInstance

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

                          $this->exportRelatedLists($this->moduleInstance);

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

                       * @param int         $blockid

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

                          $this->exportCustomLinks($this->moduleInstance);

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

                                  $createTable = \App\Db::getInstance()->createCommand('SHOW CREATE TABLE ' . $table)->queryOne();

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

                                  $this->openNode('table');

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

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

                              $this->zipFileName = $this->_export_tmpdir . '/' . $this->zipFileName;

                  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

                              $zip->addDirectory(

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

                                  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

                                  $moduleLayout = $layoutName . "/modules/$module";

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

                          foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator('languages', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {

                  Line exceeds 120 characters; contains 185 characters
                  Open

                          foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator('languages', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {

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

                          $this->outputNode($row['premium'], 'premium');

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

                          // Export Related Lists

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_blocks')->where(['tabid' => $moduleInstance->id])->orderBy(['sequence' => SORT_ASC])->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

                       */

                  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 getZipFileName()

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

                          $this->zipFileName = $zipFileName;

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

                          $zip = \App\Zip::createFile($this->zipFileName);

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

                          // Add manifest file

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

                              $zip->addDirectory("cron/modules/{$module}", 'cron', 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

                              }

                  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

                                  $minVersion = $prefValue;

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

                          } elseif (1 == $tabType) {

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

                      /**

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

                              $focus = \CRMEntity::getInstance($modulename);

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

                              $tables = $focus->tab_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

                          $this->openNode('blocks');

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

                              $this->outputNode($row['blocklabel'], 'blocklabel');

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

                      }

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

                          $module = $this->moduleInstance->name;

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

                                  "modules/Settings/{$module}",

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

                                  true

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

                                  'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}",

                  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_html/layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/{$module}/resources",

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

                              $zip->addDirectory(

                  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

                          //Copy language files

                  Line exceeds 120 characters; contains 124 characters
                  Open

                              $zip->addFile('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png", "$module.png");

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

                              ->from('vtiger_tab')

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

                          // Export module blocks

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

                          }

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

                          }

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

                          if (!$this->moduleInstance->isentitytype) {

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

                          // Export Custom Links

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

                              if (false !== ($key = array_search('vtiger_crmentity', $tables))) {

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

                              $type = 'entity';

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

                          }

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

                          // Export module filters

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

                      public function exportBlocks(ModuleBasic $moduleInstance)

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

                          // Export module inventory fields

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

                              $this->exportInventory();

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

                       */

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

                          $modulename = $this->moduleInstance->name;

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

                       */

                  Line exceeds 120 characters; contains 126 characters
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_tab_info')->where(['tabid' => $moduleId])->createCommand()->query();

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

                          $tabType = $row['type'];

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

                          $this->exportActions($this->moduleInstance);

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

                       * Export module base and related tables.

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

                                  unset($tables[$key]);

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

                              foreach ($tables as $table) {

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

                                  $this->outputNode($table, '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

                              $this->outputNode($row['show_title'], 'show_title');

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

                              $this->closeNode('block');

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

                  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_resources',

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

                              );

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

                          //Support to multiple layouts of module

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

                                      $zip->addDirectory($settingsLayout, $settingsLayout);

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

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

                          $this->outputNode(date('Y-m-d H:i:s'), 'exporttime');

                  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->exportBlocks($this->moduleInstance);

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

                          $this->exportCustomViews($this->moduleInstance);

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

                              $this->outputNode($row['visible'], 'visible');

                  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 exportFields(ModuleBasic $moduleInstance, $blockid)

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

                      public function exportDependencies(ModuleBasic $moduleInstance)

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

                          $moduleId = $moduleInstance->id;

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

                              $prefValue = $row['prefvalue'];

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

                          }

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

                              ->where(['tabid' => $moduleId])

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

                              $type = 'extension';

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

                          $this->exportDependencies($this->moduleInstance);

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

                      public function exportTables()

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

                          if ($this->moduleInstance->isentitytype) {

                  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 ModuleBasic $moduleInstance

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

                              $this->outputNode($row['display_status'], 'display_status');

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

                              $fieldParams = $row['fieldparams'];

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

                              if (isset($row['summaryfield'])) {

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

                              // Export field to module relations

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

                                      $this->openNode('relatedmodules');

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

                                  }

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

                                      $dataReaderRow->close();

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

                      public function exportCustomViews(ModuleBasic $moduleInstance)

                  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->openNode('entityidentifier');

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

                                  $this->closeNode('entityidentifier');

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

                                  $treesExist = (new \App\Db\Query())->select(['name', 'access'])->from('vtiger_trees_templates')->where(['templateid' => $fieldParams])->one();

                  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->closeNode('field');

                  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

                              $setdefault = (1 == $row['setdefault']) ? 'true' : '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

                          //Copy module templates files

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

                          if (file_exists("config/Modules/$module.php")) {

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

                      public function __copyLanguageFiles(\App\Zip $zip, $module)

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

                              if ($item->isFile() && $item->getFilename() === $module . '.json') {

                  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->outputNode($minVersion, 'vtiger_version');

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

                          $this->outputNode($row['name'], 'name');

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

                          $this->outputNode($type, 'type');

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

                          if (1 == $tabType) {

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

                              // Setup required module variables which is need for vtlib API's

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

                                  $this->closeNode('table');

                  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->outputNode($row['edit_view'], 'edit_view');

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

                              $this->outputNode($row['displaytype'], 'displaytype');

                  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

                                  if (is_dir($moduleLayout)) {

                  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 ModuleBasic $moduleInstance

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

                          $minVersion = \App\Version::get();

                  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

                              ->select(['name', 'tablabel', 'version', 'type', 'premium'])

                  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

                              $this->outputNode($row['iscustom'], 'iscustom');

                  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

                              return;

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

                          }

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

                          // Copy cron files of the module (if any)

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

                          $layoutDirectories = glob('layouts' . '/*', GLOB_ONLYDIR);

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

                                  $settingsLayout = $layoutName . "/modules/Settings/$module";

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

                          if (file_exists('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png")) {

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

                       * Function copies language files to zip.

                  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   $module

                  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

                          if (false !== $maxVersion) {

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

                              \VtlibUtils::vtlibSetupModulevars($modulename, $focus);

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

                              }

                  Line exceeds 120 characters; contains 169 characters
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_blocks')->where(['tabid' => $moduleInstance->id])->orderBy(['sequence' => SORT_ASC])->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

                              $this->outputNode($row['detail_view'], 'detail_view');

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

                              // Export fields associated with the block

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

                          $this->closeNode('blocks');

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

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

                       * Get last name of zip file.

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

                       * Export Module as a zip file.

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

                       * @param \vtlib\Module $moduleInstance Instance of module

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

                      {

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

                          // Export as Zip

                  Line exceeds 120 characters; contains 134 characters
                  Open

                              $this->zipFileName = $this->moduleInstance->name . '_' . date('Y-m-d-Hi') . '_' . $this->moduleInstance->version . '.zip';

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

                          if (is_dir("modules/Settings/$module")) {

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

                              $zip->addDirectory(

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

                                  true

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

                                  'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/{$module}",

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

                              $zip->addFile("config/Modules/$module.php", "config/$module.php");

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

                                  $filePath = $item->getRealPath();

                  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

                          $this->openNode('dependencies');

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

                              ->one();

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

                          if ($tabVersion) {

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

                          $this->exportSharingAccess($this->moduleInstance);

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

                          // Export Actions

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

                                  $this->outputNode('<![CDATA[' . \App\Purifier::decodeHtml($createTable['Create Table']) . ']]>', 'sql');

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

                          $this->closeNode('tables');

                  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

                              $this->openNode('block');

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

                              $this->outputNode($row['sequence'], 'sequence');

                  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->outputNode($row['info_type'], 'info_type');

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

                              $columnName = $row['columnname'];

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

                                  foreach (\App\Fields\Picklist::getValuesName($fieldname) as $picklistvalue) {

                  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 ('10' == $uiType) {

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

                                  if ($fieldRelModule) {

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

                                      foreach ($fieldRelModule as $row) {

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

                                  $this->outputNode($valueFieldNumber->get('leading_zeros'), 'leading_zeros');

                  Line exceeds 120 characters; contains 158 characters
                  Open

                                  $treesExist = (new \App\Db\Query())->select(['name', 'access'])->from('vtiger_trees_templates')->where(['templateid' => $fieldParams])->one();

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

                                  if ($treesExist) {

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

                                          $this->outputNode($row['label'], 'label');

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

                              $this->openNode('customview');

                  Line exceeds 120 characters; contains 178 characters
                  Open

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();

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

                              $this->outputNode($row['presence'], 'presence');

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

                              if ($fieldname == $entityField['fieldname']) {

                  Line exceeds 120 characters; contains 159 characters
                  Open

                                  $fieldRelModule = (new \App\Db\Query())->select(['relmodule'])->from('vtiger_fieldmodulerel')->where(['fieldid' => $row['fieldid']])->column();

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

                                      $this->closeNode('relatedmodules');

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

                                      $this->outputNode($treesExist['access'], 'access');

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

                                      $dataReaderRow = (new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => $fieldParams])->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

                      }

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

                              $this->outputNode($row['featured'], 'featured');

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

                              $this->openNode('fields');

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

                              if (isset($row['masseditable'])) {

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

                                  $this->outputNode($row['masseditable'], 'masseditable');

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

                                  $this->outputNode($entityField['entityidcolumn'], 'entityidcolumn');

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

                              if ('15' == $uiType || '16' == $uiType || '111' == $uiType || '33' == $uiType || '55' == $uiType) {

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

                                          $this->openNode('tree_value');

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

                                          $this->outputNode($row['state'], 'state');

                  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->outputNode($row['presence'], 'presence');

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

                              while ($cvRow = $cvColumnDataReader->read()) {

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

                              $infoSchema = \App\Db::getInstance()->getTableSchema($tableName);

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

                                  $this->closeNode('picklistvalues');

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

                                  $this->openNode('numberInfo');

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

                                          $this->outputNode($row['name'], 'name');

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

                                          $this->outputNode($row['parentTree'], 'parentTree');

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

                                  $this->closeNode('tree_template');

                  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

                              $this->outputNode($setdefault, 'setdefault');

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

                              $this->outputNode('<![CDATA[' . $row['description'] . ']]>', 'description');

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

                          $this->closeNode('customviews');

                  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 '1':

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

                                      case '2':

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

                                  $this->outputNode($row['label'], 'label');

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

                                  $this->outputNode($row['view_type'], 'view_type');

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

                                  $this->outputNode($row['field_name'], 'field_name');

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

                                      $actions = explode(',', $actionText);

                  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 ModuleBasic $moduleInstance

                  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->closeNode('actions');

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

                                  $this->outputNode($row['presence'], 'presence');

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

                                  $this->outputNode($row['sequence'], 'sequence');

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

                                  $this->outputNode($row['field_name'], 'field_name');

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

                          if (!$moduleInstance->isentitytype) {

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

                                  $this->openNode('relatedlist');

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

                                  if (!empty($actionText)) {

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

                                      $this->openNode('actions');

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

                                  $this->closeNode('relatedlist');

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

                                  $this->outputNode($row['name'], 'function');

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

                                  $this->outputNode($row['favorites'], 'favorites');

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

                                  $this->outputNode($row['view_type'], 'view_type');

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

                                  }

                  Line exceeds 120 characters; contains 154 characters
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();

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

                              $this->openNode('field');

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

                              $tableName = $row['tablename'];

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

                              $this->outputNode($tableName, 'tablename');

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

                              $this->outputNode($row['typeofdata'], 'typeofdata');

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

                                  $this->outputNode($row['summaryfield'], 'summaryfield');

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

                                          $this->outputNode($row, 'relatedmodule');

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

                                  $this->outputNode($valueFieldNumber->get('cur_sequence'), 'cur_sequence');

                  Line exceeds 120 characters; contains 161 characters
                  Open

                                      $dataReaderRow = (new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => $fieldParams])->createCommand()->query();

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

                                      $this->openNode('tree_values');

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

                       * Export Custom views of the module.

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

                              ->createCommand()->query();

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

                              $this->outputNode($fieldname, 'fieldname');

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

                              $this->outputNode($row['viewname'], 'viewname');

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

                              $rules = \App\CustomView::getConditions($cvid);

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

                              $this->outputNode($row['quickcreate'], 'quickcreate');

                  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->outputNode($row['fieldparams'], 'fieldparams');

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

                      public function exportSharingAccess(ModuleBasic $moduleInstance)

                  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->openNode('sharingaccess');

                  Line exceeds 120 characters; contains 149 characters
                  Open

                          $permission = (new \App\Db\Query())->select(['permission'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->column();

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

                          $this->closeNode('fields');

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

                                          $permissiontext = 'private';

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

                              $this->outputNode($row['privileges'], 'privileges');

                  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->outputNode($permissiontext, 'default');

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

                                  switch ($row) {

                  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->outputNode($row['sort'], 'sort');

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

                                          break;

                  Line exceeds 120 characters; contains 295 characters
                  Open

                          $dataReader = (new \App\Db\Query())->select(['actionname'])->from('vtiger_profile2utility')->innerJoin('vtiger_actionmapping', 'vtiger_profile2utility.activityid = vtiger_actionmapping.actionid')->where(['tabid' => $moduleInstance->id])->distinct('actionname')->createCommand()->query();

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

                          if ($dataReader->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

                              $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

                                  $this->outputNode($row['sequence'], 'sequence');

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

                                      foreach ($fields as $field) {

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

                                  $this->outputNode('<![CDATA[' . $row['actionname'] . ']]>', '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

                       * Export related lists associated with module.

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

                       * @param ModuleBasic $moduleInstance

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

                                  if ($fields = \App\Field::getFieldsFromRelation($row['relation_id'])) {

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

                              $this->openNode('inrelatedlists');

                  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

                                  $this->outputNode(Module::getInstance($row['tabid'])->name, 'inrelatedmodule');

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

                                      foreach ($actions as $action) {

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

                          if ($dataReaderRow->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

                                  if (!empty($actionText)) {

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

                                  $this->outputNode($row['creator_detail'], 'creator_detail');

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

                                      $this->openNode('actions');

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

                       */

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

                                      $actions = explode(',', $actionText);

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

                          $permission = (new \App\Db\Query())->select(['permission'])->from('vtiger_def_org_share')->where(['tabid' => $moduleInstance->id])->column();

                  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->closeNode('action');

                  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 (!$moduleInstance->isentitytype) {

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

                          $moduleId = $moduleInstance->id;

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['tabid' => $moduleId])->createCommand()->query();

                  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

                                  $this->outputNode(Module::getInstance($row['related_tabid'])->name, 'relatedmodule');

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

                                          $this->outputNode($field, 'field');

                  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->openNode('inrelatedlist');

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

                                      $this->openNode('fields');

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

                          $dataReader = (new \App\Db\Query())->from('vtiger_field')->where(['tabid' => $moduleInstance->id, 'block' => $blockid])->createCommand()->query();

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

                              $this->outputNode($columnName, 'columnname');

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

                                  $this->openNode('tree_template');

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

                      /**

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

                          $entityField = (new \App\Db\Query())->select(['fieldname', 'entityidfield', 'entityidcolumn'])->from('vtiger_entityname')->where(['tabid' => $moduleInstance->id])->one();

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

                          $this->openNode('customviews');

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

                              $this->outputNode($row['sequence'], 'sequence');

                  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->outputNode($row['quickcreatesequence'], 'quickcreatesequence');

                  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 '0':

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

                                      case '3':

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

                                  $this->openNode('picklistvalues');

                  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->outputNode($valueFieldNumber->get('reset_sequence'), 'reset_sequence');

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

                       * @param ModuleBasic $moduleInstance

                  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->outputNode($infoSchema->columns[$columnName]->dbType, 'columntype');

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

                                  $this->outputNode('', 'fieldparams');

                  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->outputNode($row['helpinfo'], 'helpinfo');

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

                                      $this->closeNode('tree_values');

                  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->openNode('relatedlists');

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

                              $cvid = $row['cvid'];

                  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->outputNode($row['name'], 'function');

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

                              // Export picklist values for picklist fields

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

                                  $this->outputNode($row['favorites'], 'favorites');

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

                                  $this->openNode('field');

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

                                      $this->outputNode($picklistvalue, 'picklistvalue');

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

                                  $this->outputNode($valueFieldNumber->get('postfix'), 'postfix');

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

                                  $this->outputNode($row['creator_detail'], 'creator_detail');

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

                                  $this->outputNode('<![CDATA[' . \App\Json::encode($rules) . ']]>', 'rules');

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

                                          $this->closeNode('tree_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

                                  $this->outputNode($row['relation_comment'], 'relation_comment');

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

                          if (!$customViewDataReader->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

                                      foreach ($actions as $action) {

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

                              $cvColumnDataReader = (new \App\Db\Query())->from('vtiger_cvcolumnlist')->where(['cvid' => $cvid])->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

                          }

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

                       * Export Sharing Access of the module.

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

                                  if ($fields = \App\Field::getFieldsFromRelation($row['relation_id'])) {

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

                              foreach ($permission as $row) {

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

                              $this->closeNode('fields');

                  Line exceeds 120 characters; contains 141 characters
                  Open

                          $dataReaderRow = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['related_tabid' => $moduleId])->createCommand()->query();

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

                                          $permissiontext = 'public_readwrite';

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

                                  $this->outputNode($row['presence'], 'presence');

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

                              $this->closeNode('customview');

                  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->closeNode('sharingaccess');

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

                          $dataReaderRow = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['related_tabid' => $moduleId])->createCommand()->query();

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

                                          $this->outputNode($action, 'action');

                  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

                                  $this->outputNode($row['label'], 'label');

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

                                      }

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

                      }

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

                      public function exportRelatedLists(ModuleBasic $moduleInstance)

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

                                  $actionText = $row['actions'];

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

                                          $this->outputNode($action, 'action');

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

                          // Relations in the opposite direction

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

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

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

                                  $this->outputNode($row['relation_comment'], 'relation_comment');

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

                                      foreach ($fields as $field) {

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

                              $fieldname = $row['fieldname'];

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

                              $this->outputNode($row['fieldlabel'], 'fieldlabel');

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

                                  $this->outputNode($valueFieldNumber->get('start_id'), 'start_id');

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

                                  $this->closeNode('numberInfo');

                  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->outputNode($treesExist['name'], 'name');

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

                          $customViewDataReader = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])

                  Line exceeds 120 characters; contains 128 characters
                  Open

                          $customViewDataReader = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])

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

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

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

                                  $this->outputNode($cvRow['field_name'], 'fieldname');

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

                                  $this->outputNode($cvRow['module_name'], 'modulename');

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

                                  if ($cvRow['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

                          if (empty($permission)) {

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

                          if ($permission) {

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

                                      $this->closeNode('actions');

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

                              // Export Entity Identifier Information

                  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->outputNode($valueFieldNumber->get('cur_id'), 'cur_id');

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

                                  $this->outputNode($cvRow['columnindex'], 'columnindex');

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

                              if (!empty($rules)) {

                  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

                              $this->openNode('actions');

                  Line exceeds 120 characters; contains 130 characters
                  Open

                          $dataReader = (new \App\Db\Query())->from('vtiger_relatedlists')->where(['tabid' => $moduleId])->createCommand()->query();

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

                                      $this->openNode('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

                          $this->openNode('fields');

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

                              $uiType = $row['uitype'];

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

                              $this->outputNode($uiType, 'uitype');

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

                              $this->outputNode($row['generatedtype'], 'generatedtype');

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

                              $this->outputNode($row['maximumlength'], 'maximumlength');

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

                                  $fieldRelModule = (new \App\Db\Query())->select(['relmodule'])->from('vtiger_fieldmodulerel')->where(['fieldid' => $row['fieldid']])->column();

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

                              if ('4' == $uiType) {

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

                                  $this->outputNode($valueFieldNumber->get('prefix'), 'prefix');

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

                                      $this->outputNode($cvRow['source_field_name'], 'sourcefieldname');

                  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

                                      $this->closeNode('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

                              $this->closeNode('relatedlists');

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

                                  $this->outputNode($entityField['entityidfield'], 'entityidfield');

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

                              if ('302' == $uiType) {

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

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

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

                                          $this->outputNode($row['tree'], 'tree');

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

                                          $this->outputNode($row['depth'], 'depth');

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

                              $setmetrics = (1 == $row['setmetrics']) ? 'true' : 'false';

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

                              $this->outputNode($row['sequence'], 'sequence');

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

                                  $this->closeNode('field');

                  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

                          $customViewDataReader->close();

                  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

                                          $permissiontext = '';

                  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->outputNode($row['readonly'], 'readonly');

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

                                          $permissiontext = 'public_readwritedelete';

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

                              $this->outputNode($row['defaultvalue'], 'defaultvalue');

                  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

                      public function exportActions(ModuleBasic $moduleInstance)

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

                                  $valueFieldNumber = \App\Fields\RecordNumber::getInstance($moduleInstance->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

                          }

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

                       * @param ModuleBasic $moduleInstance

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

                          $dataReader = (new \App\Db\Query())->select(['actionname'])->from('vtiger_profile2utility')->innerJoin('vtiger_actionmapping', 'vtiger_profile2utility.activityid = vtiger_actionmapping.actionid')->where(['tabid' => $moduleInstance->id])->distinct('actionname')->createCommand()->query();

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

                                  $this->openNode('action');

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

                              $this->outputNode($setmetrics, 'setmetrics');

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

                          if ($dataReader->count()) {

                  Line exceeds 120 characters; contains 137 characters
                  Open

                              $cvColumnDataReader = (new \App\Db\Query())->from('vtiger_cvcolumnlist')->where(['cvid' => $cvid])->createCommand()->query();

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

                                      $this->closeNode('actions');

                  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

                              $dataReader->close();

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

                                  $actionText = $row['actions'];

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

                       * Export actions.

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

                                  $this->outputNode('enabled', 'status');

                  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->outputNode($field, 'field');

                  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 ($customlinks as $customlink) {

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

                                  $this->closeNode('customlink');

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

                          $cronTasks = Cron::listAllInstancesByModule($moduleInstance->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

                                      }

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

                              $this->openNode('customlinks');

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

                                  $this->openNode('customlink');

                  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

                          $this->closeNode('inventory');

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

                      }

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

                       * Export custom links of the module.

                  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->outputNode($cronTask->getHandlerClass(), 'handler');

                  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(\Vtiger_Inventory_Model::getInstance($this->moduleInstance->name)->getTableName())->createCommand()->query();

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

                          $this->openNode('inventory');

                  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->outputNode($cronTask->getSequence(), 'sequence');

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

                       * Export module inventory fields.

                  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

                          $this->openNode('fields');

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

                          $this->closeNode('fields');

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

                              $dataReaderRow->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

                          $customlinks = $moduleInstance->getLinksForExport();

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

                                  $this->outputNode("<![CDATA[$customlink->linkicon]]>", 'linkicon');

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

                      public function exportCronTasks(ModuleBasic $moduleInstance)

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

                          $this->openNode('crons');

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

                          $this->closeNode('crons');

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

                              $this->outputNode($row['sequence'], 'sequence');

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

                              $this->outputNode($row['displaytype'], 'displaytype');

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

                              $this->closeNode('field');

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

                              $this->outputNode($cronTask->getName(), 'name');

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

                              $this->outputNode($cronTask->getFrequency(), 'frequency');

                  Line exceeds 120 characters; contains 159 characters
                  Open

                          $dataReader = (new \App\Db\Query())->from(\Vtiger_Inventory_Model::getInstance($this->moduleInstance->name)->getTableName())->createCommand()->query();

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

                                  $this->closeNode('inrelatedlist');

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

                                  $this->outputNode("<![CDATA[$customlink->linkurl]]>", 'linkurl');

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

                                  $this->outputNode("<![CDATA[$customlink->handler_class]]>", 'handler_class');

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

                                  $this->outputNode("<![CDATA[$customlink->handler]]>", 'handler');

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

                       * Export cron tasks for the module.

                  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->outputNode($row['defaultvalue'], 'defaultvalue');

                  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 ModuleBasic $moduleInstance

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

                              $this->outputNode($cronTask->getStatus(), 'status');

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

                              $this->closeNode('cron');

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

                              $this->outputNode($row['params'], 'params');

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

                                  $this->outputNode($customlink->linklabel, 'linklabel');

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

                                  $this->outputNode("<![CDATA[$customlink->handler_path]]>", 'handler_path');

                  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

                              $this->outputNode($row['columnname'], 'columnname');

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

                              $this->outputNode($row['block'], 'block');

                  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->outputNode($customlink->linktype, 'linktype');

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

                          if (0 == $dataReader->count()) {

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

                              $this->outputNode($row['label'], 'label');

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

                                  $this->outputNode($customlink->sequence, 'sequence');

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

                              $this->closeNode('customlinks');

                  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 ($cronTasks as $cronTask) {

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

                              $this->outputNode($cronTask->getDescription(), 'description');

                  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->outputNode($row['colspan'], 'colspan');

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

                       * @param ModuleBasic $moduleInstance

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

                                      $this->closeNode('fields');

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

                          if (!empty($customlinks)) {

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

                              $this->outputNode($row['invtype'], 'invtype');

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

                              $this->outputNode($row['presence'], 'presence');

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

                              $this->openNode('cron');

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

                      public function exportInventory()

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

                          }

                  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

                              $this->openNode('field');

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

                              $this->closeNode('inrelatedlists');

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

                      public function exportCustomLinks(ModuleBasic $moduleInstance)

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

                          $dataReader->close();

                  The method __copyLanguageFiles is not named in camelCase.
                  Open

                      public function __copyLanguageFiles(\App\Zip $zip, $module)
                      {
                          foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator('languages', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
                              if ($item->isFile() && $item->getFilename() === $module . '.json') {
                                  $filePath = $item->getRealPath();
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCaseMethodName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method __getManifestFilePath is not named in camelCase.
                  Open

                      public function __getManifestFilePath()
                      {
                          if (empty($this->_export_modulexml_filename)) {
                              // Set the module xml filename to be written for exporting.
                              $this->_export_modulexml_filename = 'manifest-' . time() . '.xml';
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCaseMethodName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method __cleanupExport is not named in camelCase.
                  Open

                      public function __cleanupExport()
                      {
                          if (!empty($this->_export_modulexml_filename)) {
                              unlink($this->__getManifestFilePath());
                          }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCaseMethodName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method __write is not named in camelCase.
                  Open

                      public function __write($value)
                      {
                          fwrite($this->_export_modulexml_file, $value ?? '');
                      }
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCaseMethodName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method __finishExport is not named in camelCase.
                  Open

                      public function __finishExport()
                      {
                          if (!empty($this->_export_modulexml_file)) {
                              fclose($this->_export_modulexml_file);
                              $this->_export_modulexml_file = null;
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCaseMethodName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method __initExport is not named in camelCase.
                  Open

                      public function __initExport($module)
                      {
                          if ($this->moduleInstance->isentitytype) {
                              // We will be including the file, so do a security check.
                              Utils::checkFileAccessForInclusion("modules/$module/$module.php");
                  Severity: Minor
                  Found in vtlib/Vtiger/PackageExport.php by phpmd

                  CamelCaseMethodName

                  Since: 0.2

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

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  There are no issues that match your filters.

                  Category
                  Status