YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/actions/RelationAjax.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

File RelationAjax.php has 355 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
Severity: Minor
Found in modules/Vtiger/actions/RelationAjax.php - About 4 hrs to fix

    Function updateRelation has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateRelation(App\Request $request)
        {
            $sourceModule = $request->getModule();
            $sourceRecordId = $request->getInteger('src_record');
            $relatedModule = $request->getByType('related_module', 2);
    Severity: Minor
    Found in modules/Vtiger/actions/RelationAjax.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function getRelatedListPageCount has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getRelatedListPageCount(App\Request $request)
        {
            $moduleName = $request->getModule();
            $relatedModuleName = $request->getArray('relatedModule', 'Alnum');
            $firstRelatedModuleName = current($relatedModuleName);
    Severity: Minor
    Found in modules/Vtiger/actions/RelationAjax.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

    The class Vtiger_RelationAjax_Action has 11 public methods. Consider refactoring Vtiger_RelationAjax_Action to keep number of public methods under 10.
    Open

    class Vtiger_RelationAjax_Action extends \App\Controller\Action
    {
        use App\Controller\ClearProcess;
        use \App\Controller\ExposeMethod;
    
    

    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 Vtiger_RelationAjax_Action has an overall complexity of 99 which is very high. The configured complexity threshold is 50.
    Open

    class Vtiger_RelationAjax_Action extends \App\Controller\Action
    {
        use App\Controller\ClearProcess;
        use \App\Controller\ExposeMethod;
    
    

    Method getRelatedListPageCount has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRelatedListPageCount(App\Request $request)
        {
            $moduleName = $request->getModule();
            $relatedModuleName = $request->getArray('relatedModule', 'Alnum');
            $firstRelatedModuleName = current($relatedModuleName);
    Severity: Major
    Found in modules/Vtiger/actions/RelationAjax.php - About 2 hrs to fix

      Function checkPermission has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function checkPermission(App\Request $request)
          {
              $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
              if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {
                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);
      Severity: Minor
      Found in modules/Vtiger/actions/RelationAjax.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 updateRelation has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateRelation(App\Request $request)
          {
              $sourceModule = $request->getModule();
              $sourceRecordId = $request->getInteger('src_record');
              $relatedModule = $request->getByType('related_module', 2);
      Severity: Minor
      Found in modules/Vtiger/actions/RelationAjax.php - About 1 hr to fix

        Method getRelationListModel has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getRelationListModel(App\Request $request)
            {
                $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
                $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');
                $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', \App\Purifier::ALNUM);
        Severity: Minor
        Found in modules/Vtiger/actions/RelationAjax.php - About 1 hr to fix

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

              public static function getRelationListModel(App\Request $request)
              {
                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');
                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', \App\Purifier::ALNUM);
          Severity: Minor
          Found in modules/Vtiger/actions/RelationAjax.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

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

              public function deleteRelation(App\Request $request)
              {
                  $sourceModule = $request->getModule();
                  $sourceRecordId = $request->getInteger('src_record');
                  $relatedModule = $request->getByType('related_module', 2);
          Severity: Minor
          Found in modules/Vtiger/actions/RelationAjax.php - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function addRelation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addRelation(App\Request $request)
              {
                  $sourceModule = $request->getModule();
                  $sourceRecordId = $request->getInteger('src_record');
                  $relatedModule = $request->getByType('related_module', 2);
          Severity: Minor
          Found in modules/Vtiger/actions/RelationAjax.php - About 35 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 massDeleteRelation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function massDeleteRelation(App\Request $request)
              {
                  $sourceModule = $request->getModule();
                  $relatedModuleName = $request->getByType('relatedModule', 2);
                  $sourceRecordId = $request->getInteger('src_record');
          Severity: Minor
          Found in modules/Vtiger/actions/RelationAjax.php - About 35 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 updateRelation() has an NPath complexity of 640. The configured NPath complexity threshold is 200.
          Open

              public function updateRelation(App\Request $request)
              {
                  $sourceModule = $request->getModule();
                  $sourceRecordId = $request->getInteger('src_record');
                  $relatedModule = $request->getByType('related_module', 2);

          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 getRelatedListPageCount() has an NPath complexity of 2448. The configured NPath complexity threshold is 200.
          Open

              public function getRelatedListPageCount(App\Request $request)
              {
                  $moduleName = $request->getModule();
                  $relatedModuleName = $request->getArray('relatedModule', 'Alnum');
                  $firstRelatedModuleName = current($relatedModuleName);

          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 getRelationListModel() has an NPath complexity of 1728. The configured NPath complexity threshold is 200.
          Open

              public static function getRelationListModel(App\Request $request)
              {
                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');
                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', \App\Purifier::ALNUM);

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

              public function getRelatedListPageCount(App\Request $request)
              {
                  $moduleName = $request->getModule();
                  $relatedModuleName = $request->getArray('relatedModule', 'Alnum');
                  $firstRelatedModuleName = current($relatedModuleName);

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

              public function checkPermission(App\Request $request)
              {
                  $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {
                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

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

              public static function getRelationListModel(App\Request $request)
              {
                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');
                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', \App\Purifier::ALNUM);

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

              public function updateRelation(App\Request $request)
              {
                  $sourceModule = $request->getModule();
                  $sourceRecordId = $request->getInteger('src_record');
                  $relatedModule = $request->getByType('related_module', 2);

          CyclomaticComplexity

          Since: 0.1

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

          Example

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

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

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

              public function checkPermission(App\Request $request)

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

              public function updateRelation(App\Request $request)

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

              public function getRelatedListPageCount(App\Request $request)

          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 Vtiger_RelationAjax_Action has a coupling between objects value of 26. Consider to reduce the number of dependencies under 13.
          Open

          class Vtiger_RelationAjax_Action extends \App\Controller\Action
          {
              use App\Controller\ClearProcess;
              use \App\Controller\ExposeMethod;
          
          

          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 '398', column '14').
          Open

                      throw new \App\Exceptions\Security('ERR_NO_ACCESS_TO_THE_FIELD', 403);

          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 '218', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '189', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '45', column '14').
          Open

                      throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          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 '362', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '316', column '14').
          Open

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

          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 '379', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '157', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '144', column '14').
          Open

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

          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 '50', column '16').
          Open

                              throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          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 '333', column '23').
          Open

                      $pagingModel = new Vtiger_Paging_Model();

          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 '282', column '15').
          Open

                          throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

          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 '231', column '14').
          Open

                      throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          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 '404', column '14').
          Open

                      throw new \App\Exceptions\NotAllowedMethod('LBL_PERMISSION_DENIED', 406);

          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 '412', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '42', column '14').
          Open

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

          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 '299', column '19').
          Open

                  $response = new Vtiger_Response();

          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 '39', column '14').
          Open

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

          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 '401', column '14').
          Open

                      throw new \App\Exceptions\Security('ERR_NOT_SUPPORTED_FIELD', 406);

          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 '296', column '15').
          Open

                          throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

          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 '54', column '16').
          Open

                              throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          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 '409', column '124').
          Open

                  $query = $queryGenerator->setFields(['id'])->setDistinct(null)->setGroup('id')->createQuery()->select([$fieldName => new \yii\db\Expression("MAX({$columnName})")]);

          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 '410', column '17').
          Open

                  $value = (new \App\Db\Query())->from(['c' => $query])->sum("c.{$fieldName}");

          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 '455', column '19').
          Open

                  $response = new Vtiger_Response();

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

                  } else {
                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));
                  }

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

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

                      } else {
                          throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
                      }

          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_Record_Model' in method 'getRelatedListPageCount'.
          Open

                      $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'App\Condition' in method 'getRelationListModel'.
          Open

                      $relationListView->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'addRelation'.
          Open

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Record_Model' in method 'massDeleteRelation'.
          Open

                  $parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModule);

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

                  } else {
                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));
                  }

          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 '47', column '63').
          Open

              public function checkPermission(App\Request $request)
              {
                  $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {
                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

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

                  $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $relationId, $cvId);

          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\Privilege' in method 'updateRelation'.
          Open

                          if (\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedRecordId)) {

          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 'ModTracker_Record_Model' in method 'getRelatedListPageCount'.
          Open

                      $count = (int) ($unreviewed = current(ModTracker_Record_Model::getUnreviewed($parentId, false, true))) ? array_sum($unreviewed) : '';

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

                          } else {
                              $totalCount += (int) $relationListView->getRelatedEntriesCount();
                          }

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Privilege' in method 'checkPermission'.
          Open

                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {

          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_Relation_Model' in method 'addRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

          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\Privilege' in method 'massDeleteRelation'.
          Open

                          if (\App\Privilege::isPermitted($relatedModuleName, 'DetailView', $relatedRecordId) && $relationModel->privilegeToDelete(null, $relatedRecordId)) {

          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\Privilege' in method 'checkPermission'.
          Open

                  if (!$request->isEmpty('src_record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('src_record'))) {

          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\Privilege' in method 'addRelation'.
          Open

                  if (!\App\Privilege::isPermitted($sourceModule, 'DetailView', $sourceRecordId)) {

          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\Privilege' in method 'addRelation'.
          Open

                      if (\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedRecordId)) {

          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_Relation_Model' in method 'updateFavoriteForRecord'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

          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\Module' in method 'addRelation'.
          Open

                      $relatedModule = \App\Module::getModuleName($relatedModule);

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'addRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

                  } else {
                      $relModules = !empty($relatedModuleName) && \is_array($relatedModuleName) ? $relatedModuleName : [];
                      if ('ProductsAndServices' === $firstRelatedModuleName) {
                          $relModules = ['Products', 'OutsourcedProducts', 'Assets', 'Services', 'OSSOutsourcedServices', 'OSSSoldServices'];
                      }

          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 'Calendar_Module_Model' in method 'getRelatedListPageCount'.
          Open

                              $totalCount += (int) $relationListView->getRelationQuery()->andWhere(['vtiger_activity.status' => Calendar_Module_Model::getComponentActivityStateLabel('current')])->count();

          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_Relation_Model' in method 'addRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'deleteRelation'.
          Open

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);

          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 'ModComments_Record_Model' in method 'getRelatedListPageCount'.
          Open

                      $totalCount = ModComments_Record_Model::getCommentsCount($parentId);

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

              public static function getRelationListModel(App\Request $request)
              {
                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());
                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');
                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', \App\Purifier::ALNUM);

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

                  $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $request->getByType('relatedModule', \App\Purifier::ALNUM), $relationId, $cvId);

          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_Relation_Model' in method 'deleteRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\Vtiger_Record_Model' in method 'getRelationListModel'.
          Open

                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      ->setLimit(\App\Config::performance('MAX_NUMBER_EXPORT_RECORDS'))

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                          if ('Calendar' === $relatedModuleName && \App\Config::module($relatedModuleName, 'SHOW_ONLY_CURRENT_RECORDS_COUNT')) {

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'updateFavoriteForRecord'.
          Open

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($request->getModule());

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

                  } else {
                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));
                  }

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Privilege' in method 'exportToExcel'.
          Open

                  if (!\App\Privilege::isPermitted($request->getByType('relatedModule', \App\Purifier::ALNUM), 'QuickExportToExcel')) {

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'updateRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

                      } else {
                          throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
                      }

          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_Module_Model' in method 'updateFavoriteForRecord'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($request->getByType('relatedModule', 2)));

          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\Privilege' in method 'deleteRelation'.
          Open

                          if (\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedRecordId)) {

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

                  } else {
                      Documents_Record_Model::downloadFiles($records);
                  }

          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_Relation_Model' in method 'updateRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

          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\Privilege' in method 'getRelatedListPageCount'.
          Open

                  if (!\App\Privilege::isPermitted($moduleName, 'DetailView', $parentId)) {

          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_Relation_Model' in method 'updateFavoriteForRecord'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($request->getByType('relatedModule', 2)));

          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 'Users_Privileges_Model' in method 'checkPermission'.
          Open

                  $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

                      } else {
                          if (!$userPrivilegesModel->hasModulePermission($relatedModule)) {
                              throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);
                          }
                      }

          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_Relation_Model' in method 'deleteRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

          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\Condition' in method 'getRelationListModel'.
          Open

                  $searchParams = App\Condition::validSearchParams($request->getByType('relatedModule', \App\Purifier::ALNUM), $request->getArray('search_params'));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'deleteRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Record_Model' in method 'massDownload'.
          Open

                      $documentRecordModel = Vtiger_Record_Model::getInstanceById($records[0], $relatedModuleName);

          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_Relation_Model' in method 'updateRelation'.
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_RelationListView_Model' in method 'getRelatedListPageCount'.
          Open

                          $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relModule, $relationId, $cvId);

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Module_Model' in method 'updateRelation'.
          Open

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);

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

                  } else {
                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));
                  }

          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 'Users_Privileges_Model' in method 'getRelatedListPageCount'.
          Open

                      $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Vtiger_Record_Model' in method 'checkFilesIntegrity'.
          Open

                      $documentRecordModel = Vtiger_Record_Model::getInstanceById($record, $relatedModuleName);

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      $result = ['notify' => ['text' => \App\Language::translate('LBL_FILE_NOT_AVAILABLE', $relatedModuleName) . ': <br>- ' . implode('<br>- ', $fileNotAvailable)]];

          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 'Documents_Record_Model' in method 'massDownload'.
          Open

                      Documents_Record_Model::downloadFiles($records);

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

                  if (!$request->isEmpty('search_key', true)) {

          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 "related_module" 5 times.
          Open

                  if (!$request->isEmpty('related_module', true) && !$userPrivilegesModel->hasModulePermission($request->getByType('related_module', 2))) {

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

                  if ($request->has('entityState')) {

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

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

          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 "relationId" 14 times.
          Open

                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');

          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 "DetailView" 8 times.
          Open

                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {

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

                  if (!$request->isEmpty('operator', true)) {

          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 "relatedModule" 10 times.
          Open

                  if (!$request->isEmpty('relatedModule', true) && !\is_array($relatedModule = $request->getByType('relatedModule', 2)) && 'ProductsAndServices' !== $relatedModule) {

          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 "record" 5 times.
          Open

                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {

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

                  foreach ($request->getArray('related_record_list', 'Integer') as $relatedRecordId) {

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

                  if (!$request->isEmpty('relatedModule', true) && !\is_array($relatedModule = $request->getByType('relatedModule', 2)) && 'ProductsAndServices' !== $relatedModule) {

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

                      if ('ModTracker' === $relatedModule) {

          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 "src_record" 6 times.
          Open

                  if (!$request->isEmpty('src_record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('src_record'))) {

          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 "Alnum" 5 times.
          Open

                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', 'Alnum');

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

                  if ($request->getBoolean('isSortActive') && !$request->isEmpty('orderby')) {

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

                      throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          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.

          Return type of getQuery() is undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

              public static function getQuery(App\Request $request)

          Call to method createQuery from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                  return $queryGenerator ? $queryGenerator->createQuery()->column() : [];
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to undeclared method \Vtiger_Record_Model::downloadFile
          Open

                      $documentRecordModel->downloadFile();
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method andWhere from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                              $totalCount += (int) $relationListView->getRelationQuery()->andWhere(['vtiger_activity.status' => Calendar_Module_Model::getComponentActivityStateLabel('current')])->count();
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to undeclared method \Vtiger_Record_Model::checkFileIntegrity
          Open

                      $resultVal = $documentRecordModel->checkFileIntegrity();
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to undeclared method \Vtiger_Record_Model::updateDownloadCount
          Open

                      $documentRecordModel->updateDownloadCount();
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method getQueryField from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                  $fieldQueryModel = $queryGenerator->getQueryField($request->getByType('fieldName', 2));
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method __construct from undeclared class \yii\db\Expression
          Open

                  $query = $queryGenerator->setFields(['id'])->setDistinct(null)->setGroup('id')->createQuery()->select([$fieldName => new \yii\db\Expression("MAX({$columnName})")]);
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          string to array comparison
          Open

                          if ('ProductsAndServices' === $relatedModuleName && \in_array($relModule, $categoryCount)) {

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

                  $value = (new \App\Db\Query())->from(['c' => $query])->sum("c.{$fieldName}");
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method parseBaseSearchParamsToCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                  $relationListView->set('search_params', $relationListView->getQueryGenerator()->parseBaseSearchParamsToCondition($searchParams));
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Argument 1 (moduleName) is false but \App\Export\Records::getInstance() takes string defined at /code/app/Export/Records.php:61
          Open

                  $exportModel = \App\Export\Records::getInstance($relatedModuleName, 'xls')

          Call to method setFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                  $query = $queryGenerator->setFields(['id'])->setDistinct(null)->setGroup('id')->createQuery()->select([$fieldName => new \yii\db\Expression("MAX({$columnName})")]);
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                      $relationListView->getQueryGenerator()->addCondition('id', $selectedIds, 'e');
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method addCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                      $relationListView->getQueryGenerator()->addCondition('id', $excludedIds, 'n');
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

          Call to method getModule from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                      $relationListView->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator));
          Severity: Critical
          Found in modules/Vtiger/actions/RelationAjax.php by phan

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

              public function __construct()
              {
                  parent::__construct();
                  $this->exposeMethod('addRelation');
                  $this->exposeMethod('deleteRelation');
          Severity: Major
          Found in modules/Vtiger/actions/RelationAjax.php and 1 other location - About 1 hr to fix
          modules/Vtiger/views/Import.php on lines 16..29

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 101.

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

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

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

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

          Refactorings

          Further Reading

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

                  $firstRelatedModuleName = current($relatedModuleName);

          LongVariable

          Since: 0.2

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

          Example

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

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

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

          class Vtiger_RelationAjax_Action extends \App\Controller\Action

          The class Vtiger_RelationAjax_Action is not named in CamelCase.
          Open

          class Vtiger_RelationAjax_Action extends \App\Controller\Action
          {
              use App\Controller\ClearProcess;
              use \App\Controller\ExposeMethod;
          
          

          CamelCaseClassName

          Since: 0.2

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

          Example

          class class_name {
          }

          Source

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

              {

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

                  $this->exposeMethod('exportToExcel');

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

              /** {@inheritdoc} */

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

              public function __construct()

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

              use App\Controller\ClearProcess;

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

                  $this->exposeMethod('deleteRelation');

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

                  $this->exposeMethod('massDeleteRelation');

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

                  $this->exposeMethod('addRelation');

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

              use \App\Controller\ExposeMethod;

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

                  parent::__construct();

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

              }

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

              }

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

                  $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $request->getByType('relatedModule', \App\Purifier::ALNUM), $relationId, $cvId);

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

                      $relationListView->getQueryGenerator()->addCondition('id', $selectedIds, 'e');

          Line exceeds 120 characters; contains 205 characters
          Open

                      $relationListView->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator));

          Line exceeds 120 characters; contains 154 characters
          Open

                  $searchParams = App\Condition::validSearchParams($request->getByType('relatedModule', \App\Purifier::ALNUM), $request->getArray('search_params'));

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

                      $searchParams = [];

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

                  }

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

                  $queryGenerator = static::getQuery($request);

          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 deleteRelation(App\Request $request)

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

                  $this->exposeMethod('getRelatedListPageCount');

          Line exceeds 120 characters; contains 150 characters
          Open

                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {

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

                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');

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

              }

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

                  $sourceModule = $request->getModule();

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

                  $relatedModule = $request->getByType('related_module', 2);

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

                  foreach ($request->getArray('related_record_list', 'Integer') as $relatedRecordId) {

          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\NoPermitted('LBL_PERMISSION_DENIED', 403);

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

               * @param \App\Request $request

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

              }

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

                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

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

                  if (!$request->isEmpty('operator', true)) {

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

                      $relationListView->set('search_key', $searchKey);

          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

               *

          Line exceeds 120 characters; contains 134 characters
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

                      if (\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedRecordId)) {

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

                          }

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

               * Get query for records list from request.

          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

               * Function to delete the relation for specified source record id and related record id list.

          Line exceeds 120 characters; contains 172 characters
          Open

                  if (!$request->isEmpty('relatedModule', true) && !\is_array($relatedModule = $request->getByType('relatedModule', 2)) && 'ProductsAndServices' !== $relatedModule) {

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

                      $operator = $request->getByType('operator');

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

              }

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

                  $selectedIds = $request->getArray('selected_ids', 2);

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

                  }

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

               * Function to add relation for specified source record id and related record id list.

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

                  if (is_numeric($relatedModule)) {

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

                  $this->exposeMethod('massDownload');

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

                  if (!$request->isEmpty('src_record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('src_record'))) {

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

                          if (!$userPrivilegesModel->hasModuleActionPermission($request->getModule(), 'ModTracker')) {

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

                              throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          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

                      $relationListView->set('search_value', App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator));

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

                  return $relationListView;

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

               * Get records list from request.

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

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

              /**

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

                  $sourceModule = $request->getModule();

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

                  $sourceRecordId = $request->getInteger('src_record');

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

              {

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

                  $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

                      if ('ModTracker' === $relatedModule) {

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

               * @return \App\QueryGenerator|bool

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

                  }

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

                  $searchParams = App\Condition::validSearchParams($request->getByType('relatedModule', \App\Purifier::ALNUM), $request->getArray('search_params'));

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

                  if ($excludedIds = $request->getArray('excluded_ids', \App\Purifier::INTEGER)) {

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

              public function addRelation(App\Request $request)

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

                  } else {

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

                      }

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

               * @param \App\Request $request

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

              {

          Line exceeds 120 characters; contains 158 characters
          Open

                  if (!$request->isEmpty('src_record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('src_record'))) {

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

                          if (!$userPrivilegesModel->hasModulePermission($relatedModule)) {

          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

                  }

          Line exceeds 120 characters; contains 126 characters
          Open

                      $relationListView->set('orderby', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));

          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 int[]

          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

                  $response = new Vtiger_Response();

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

              /** {@inheritdoc} */

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

              public static function getQuery(App\Request $request)

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

                  return static::getRelationListModel($request)->getRelationQuery(true)->clearFields();

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

              public static function getRelationListModel(App\Request $request)

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

                  if ($selectedIds && 'all' !== $selectedIds[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

                      $relationListView->set('entityState', $request->getByType('entityState'));

          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 ($request->getBoolean('isSortActive') && !$request->isEmpty('orderby')) {

          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 \App\Request $request

          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

                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', \App\Purifier::ALNUM);

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

                      $relationListView->set('orderby', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));

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

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

                  $response->emit();

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

                  $this->exposeMethod('checkFilesIntegrity');

          Line exceeds 120 characters; contains 145 characters
          Open

                  if (!$request->isEmpty('related_module', true) && !$userPrivilegesModel->hasModulePermission($request->getByType('related_module', 2))) {

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

                      $relationListView->set('operator', $operator);

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

                  }

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

                      $searchKey = $request->getByType('search_key', \App\Purifier::ALNUM);

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

                  if ($selectedIds && 'all' !== $selectedIds[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

                  $sourceRecordId = $request->getInteger('src_record');

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

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);

          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 (!$request->isEmpty('related_module', true) && !$userPrivilegesModel->hasModulePermission($request->getByType('related_module', 2))) {

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

                  if (!$request->isEmpty('relatedModule', true) && !\is_array($relatedModule = $request->getByType('relatedModule', 2)) && 'ProductsAndServices' !== $relatedModule) {

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

                  return $queryGenerator ? $queryGenerator->createQuery()->column() : [];

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

               * @throws \App\Exceptions\NoPermittedToRecord

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

                  if ($request->isEmpty('relationId')) {

          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 checkPermission(App\Request $request)

          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

                  $operator = 's';

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

                  if (!$request->isEmpty('search_key', true)) {

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

               * @param \App\Request $request

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

                  if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {

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

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

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

                  }

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

                  $selectedIds = $request->getArray('selected_ids', \App\Purifier::ALNUM);

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

                  $relationListView->set('search_params', $relationListView->getQueryGenerator()->parseBaseSearchParamsToCondition($searchParams));

          Line exceeds 120 characters; contains 137 characters
          Open

                  $relationListView->set('search_params', $relationListView->getQueryGenerator()->parseBaseSearchParamsToCondition($searchParams));

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

              public static function getRecordsListFromRequest(App\Request $request): array

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

                      $relatedModule = \App\Module::getModuleName($relatedModule);

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

                  }

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

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

                          $relationModel->addRelation($sourceRecordId, $relatedRecordId);

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

               * @throws \App\Exceptions\NoPermittedToRecord

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

                  $this->exposeMethod('updateFavoriteForRecord');

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

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 403);

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

                              throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);

          Line exceeds 120 characters; contains 122 characters
          Open

                  $parentRecordModel = \Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

          Line exceeds 120 characters; contains 171 characters
          Open

                  $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $request->getByType('relatedModule', \App\Purifier::ALNUM), $relationId, $cvId);

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

                      $relationListView->getQueryGenerator()->addCondition('id', $excludedIds, 'n');

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

                  if (!\App\Privilege::isPermitted($sourceModule, 'DetailView', $sourceRecordId)) {

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

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

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

                  $this->exposeMethod('updateRelation');

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

                  $this->exposeMethod('calculate');

          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 ($request->has('entityState')) {

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

                  if (empty($searchParams) || !\is_array($searchParams)) {

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

                  }

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

                  $response->setResult(true);

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

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

              public function updateRelation(App\Request $request)

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

                  $relatedModule = $request->getByType('related_module', 2);

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

                      foreach ($recordsToAdd as $relatedRecordId) {

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

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

                              $relationModel->deleteRelation((int) $sourceRecordId, (int) $relatedRecordId);

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

                  if (!empty($categoryToAdd) && $relationModel->isTreeRelation()) {

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

              public function massDeleteRelation(App\Request $request)

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

                  $relatedModuleName = $request->getByType('relatedModule', 2);

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

                  $response->emit();

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

              public function exportToExcel(App\Request $request)

          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

                  $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $relationId, $cvId);

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

                      foreach ($rows as $relatedRecordId) {

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

                  $response->setResult(['reloadList' => 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

               * @throws \App\Exceptions\NoPermitted

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

                  $categoryToAdd = $request->getArray('categoryToAdd', 'Alnum');

          Line exceeds 120 characters; contains 134 characters
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

                  } else {

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

                  }

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

                          if (\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedRecordId)) {

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

                          throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

                          $relationModel->addRelationTree($sourceRecordId, $category);

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

                  $sourceRecordId = $request->getInteger('src_record');

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

                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');

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

                  $exportModel = \App\Export\Records::getInstance($relatedModuleName, 'xls')

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

                  $exportModel->queryGenerator = $relationListView->getRelationQuery(true);

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

                  $sourceModule = $request->getModule();

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

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

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

                      if ($relationModel->privilegeToDelete()) {

          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

                  $moduleName = $request->getModule();

          Line exceeds 120 characters; contains 131 characters
          Open

                  $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $relationId, $cvId);

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

               * @throws \App\Exceptions\NoPermittedToRecord

          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 getRelatedListPageCount(App\Request $request)

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

                  $pageCount = 0;

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

                  $relatedModule = $request->getByType('related_module', 2);

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

                  $parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModule);

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

               * Export relations to excel.

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

                      ->setLimit(\App\Config::performance('MAX_NUMBER_EXPORT_RECORDS'))

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

                  $exportModel->sendHttpHeader();

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

               * Function to update the relation for specified source record id and related record id list.

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

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

          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

                      throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

               */

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

              /**

          Line exceeds 120 characters; contains 125 characters
          Open

                  if (!\App\Privilege::isPermitted($request->getByType('relatedModule', \App\Purifier::ALNUM), 'QuickExportToExcel')) {

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

               * @param \App\Request $request

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

                      }

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

               *

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

                  $relatedRecordIdList = $request->getArray('related_record_list', 'Integer');

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

                  if ($request->isEmpty('relationId')) {

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

                  $response->setResult($result);

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

                      $rows = $this->getRecordsListFromRequest($request);

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

                          }

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

                  $relatedModuleName = $relationListView->getRelatedModuleModel()->getName();

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

                              $relationModel->addRelation($sourceRecordId, $relatedRecordId);

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

                  } else {

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

                          if (\App\Privilege::isPermitted($relatedModule, 'DetailView', $relatedRecordId)) {

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

                  $response->emit();

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

               * @param \App\Request $request

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

                  if ($relationModel->privilegeToDelete()) {

          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\NoPermitted('LBL_PERMISSION_DENIED', 403);

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

                      }

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

               * Function to get the page count for related list.

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

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

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

                              $result = $relationModel->deleteRelation($sourceRecordId, (int) $relatedRecordId);

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

                          if (\App\Privilege::isPermitted($relatedModuleName, 'DetailView', $relatedRecordId) && $relationModel->privilegeToDelete(null, $relatedRecordId)) {

          Line exceeds 120 characters; contains 163 characters
          Open

                          if (\App\Privilege::isPermitted($relatedModuleName, 'DetailView', $relatedRecordId) && $relationModel->privilegeToDelete(null, $relatedRecordId)) {

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

                              $relationModel->deleteRelation((int) $sourceRecordId, (int) $relatedRecordId);

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

               * @param \App\Request $request

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

                  $headers = $relationListView->getHeaders();

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

                      ->setFormat(\App\Export\Records::USER_FORMAT);

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

                  $exportModel->exportData();

          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

                  $sourceRecordId = $request->getInteger('src_record');

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

                  if (!empty($recordsToAdd)) {

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

                  $relatedModuleName = $request->getArray('relatedModule', 'Alnum');

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

                  $firstRelatedModuleName = current($relatedModuleName);

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

                  $totalCount = 0;

          Line exceeds 120 characters; contains 134 characters
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($relatedModule));

          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

                  $categoryToRemove = $request->getArray('categoryToRemove', 'Alnum');

          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 (!\App\Privilege::isPermitted($moduleName, 'DetailView', $parentId)) {

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

                  $relationId = $request->isEmpty('relationId') ? false : $request->getInteger('relationId');

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

                  if ($relationModel->privilegeToDelete()) {

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

                      foreach ($relatedRecordIdList as $relatedRecordId) {

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

                      }

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

                  $response = new Vtiger_Response();

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

                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', 'Alnum');

          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

                          foreach ($recordsToRemove as $relatedRecordId) {

          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($categoryToRemove) && $relationModel->isTreeRelation()) {

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

                      if ($relationModel->privilegeToTreeDelete()) {

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

                  }

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

                  $sourceModule = $request->getModule();

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

                  if (!\App\Privilege::isPermitted($request->getByType('relatedModule', \App\Purifier::ALNUM), 'QuickExportToExcel')) {

          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 ($request->isEmpty('relationId')) {

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

                              $relationModel->deleteRelationTree($sourceRecordId, $category);

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

                          throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

                  $response = new Vtiger_Response();

          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 ($relModules as $relModule) {

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

                  $result['page'] = $pageCount;

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

              public function massDownload(App\Request $request)

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

                      $documentRecordModel = Vtiger_Record_Model::getInstanceById($record, $relatedModuleName);

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

                          if (!$userPrivilegesModel->hasModulePermission($relModule)) {

          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 == $pageCount) {

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

              }

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

               * Function for calculating values for a list of related records.

          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

                  $response->setResult($result);

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

               * This function removes the relationship associated with 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

                  $relationListView = static::getRelationListModel($request);

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

               *

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

                  $recordsToRemove = $request->getArray('recordsToRemove', 'Integer');

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

                  $recordsToAdd = $request->getArray('recordsToAdd', 'Integer');

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

                  $response->setResult(true);

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

               * @param \App\Request $request

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

                  $parentId = $request->getInteger('record');

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

                  $response->setResult($result);

          Line exceeds 120 characters; contains 159 characters
          Open

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($request->getByType('relatedModule', 2)));

          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

                  $response->emit();

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

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);

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

                  }

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

                  $result = false;

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

                  $response = new Vtiger_Response();

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

                  $response->emit();

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

                      $totalCount = ModComments_Record_Model::getCommentsCount($parentId);

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

               *

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

                  $relationModel = $relationListView->getRelationModel();

          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

                  $exportModel->setFields(array_keys($headers));

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

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);

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

                          }

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

                      } else {

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

                  }

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

                      foreach ($categoryToAdd as $category) {

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

                          foreach ($categoryToRemove as $category) {

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

                  $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', 'Alnum');

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

                  if ('ModComments' === $firstRelatedModuleName) {

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

                      $pagingModel = new Vtiger_Paging_Model();

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

                          if ('ProductsAndServices' === $relatedModuleName && \in_array($relModule, $categoryCount)) {

          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

                  $sourceModuleModel = Vtiger_Module_Model::getInstance($request->getModule());

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

                  } else {

          Line exceeds 120 characters; contains 190 characters
          Open

                      $result = $relationModel->updateFavoriteForRecord($request->getByType('actionMode'), ['crmid' => $request->getInteger('record'), 'relcrmid' => $request->getInteger('relcrmid')]);

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

                  $response->emit();

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

               * @throws \App\Exceptions\NotAllowedMethod

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

                  $response->emit();

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

                      $documentRecordModel->updateDownloadCount();

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

                  $fileNotAvailable = [];

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

                      }

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

                      $relModules = !empty($relatedModuleName) && \is_array($relatedModuleName) ? $relatedModuleName : [];

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

                          $pageCount = ceil((int) $totalCount / (int) $pageLimit);

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

                  }

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

                  $response->emit();

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

                      $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, Vtiger_Module_Model::getInstance($request->getByType('relatedModule', 2)));

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

                      $relationModel = Vtiger_Relation_Model::getInstanceById($request->getInteger('relationId'));

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

                  $queryGenerator = static::getQuery($request);

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

                  }

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

               * Check many files integrity.

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

                  $result = ['success' => true];

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

                  $response = new Vtiger_Response();

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

                      $count = (int) ($unreviewed = current(ModTracker_Record_Model::getUnreviewed($parentId, false, true))) ? array_sum($unreviewed) : '';

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

                              $totalCount += (int) $relationListView->getRelatedTreeEntriesCount();

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

                  if ($request->isEmpty('relationId')) {

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

               * Mass download.

          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

                      $resultVal = $documentRecordModel->checkFileIntegrity();

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

                  }

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

                      }

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

                              continue;

          Line exceeds 120 characters; contains 134 characters
          Open

                          if ('Calendar' === $relatedModuleName && \App\Config::module($relatedModuleName, 'SHOW_ONLY_CURRENT_RECORDS_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

              public function calculate(App\Request $request)

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

                  if (!$fieldModel->isViewable()) {

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

                  $response->setResult($fieldModel->getDisplayValue($value));

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

               */

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

                  }

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

                  } elseif ('ModTracker' === $firstRelatedModuleName) {

          Line exceeds 120 characters; contains 145 characters
          Open

                      $count = (int) ($unreviewed = current(ModTracker_Record_Model::getUnreviewed($parentId, false, true))) ? array_sum($unreviewed) : '';

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

                      $totalCount = $count ?: '';

          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

                          }

          Line exceeds 120 characters; contains 194 characters
          Open

                              $totalCount += (int) $relationListView->getRelationQuery()->andWhere(['vtiger_activity.status' => Calendar_Module_Model::getComponentActivityStateLabel('current')])->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

                  $value = (new \App\Db\Query())->from(['c' => $query])->sum("c.{$fieldName}");

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

                  $relatedModuleName = $request->getByType('relatedModule', 2);

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

                  }

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

                          $fileNotAvailable[] = $documentRecordModel->get('notes_title');

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

                              continue;

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

                          if (!$relationListView) {

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

                          }

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

                      $pageCount = 1;

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

                  }

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

                  $query = $queryGenerator->setFields(['id'])->setDistinct(null)->setGroup('id')->createQuery()->select([$fieldName => new \yii\db\Expression("MAX({$columnName})")]);

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

               * @param App\Request $request

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

                      Documents_Record_Model::downloadFiles($records);

          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 ('ProductsAndServices' === $firstRelatedModuleName) {

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

                  $result['numberOfRecords'] = $totalCount;

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

                  $response->setResult((bool) $result);

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

                  }

          Line exceeds 120 characters; contains 172 characters
          Open

                  $query = $queryGenerator->setFields(['id'])->setDistinct(null)->setGroup('id')->createQuery()->select([$fieldName => new \yii\db\Expression("MAX({$columnName})")]);

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

              }

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

                      $documentRecordModel->downloadFile();

          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

                  $response = new Vtiger_Response();

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

                  $response = new Vtiger_Response();

          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 \App\Request $request

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

                  $fieldModel = $fieldQueryModel->getField();

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

                  if ('sum' !== $request->getByType('calculateType')) {

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

                  if (1 === \count($records)) {

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

              /**

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

                  foreach ($this->getRecordsListFromRequest($request) as $record) {

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

                      $result = ['notify' => ['text' => \App\Language::translate('LBL_FILE_NOT_AVAILABLE', $relatedModuleName) . ': <br>- ' . implode('<br>- ', $fileNotAvailable)]];

          Line exceeds 120 characters; contains 131 characters
          Open

                          $relModules = ['Products', 'OutsourcedProducts', 'Assets', 'Services', 'OSSOutsourcedServices', 'OSSSoldServices'];

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

                      $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);

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

                              $totalCount += (int) $relationListView->getRelatedEntriesCount();

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

                  }

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

                  $columnName = $fieldQueryModel->getColumnName();

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

                  $response = new Vtiger_Response();

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

                  $records = $this->getRecordsListFromRequest($request);

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

               * @param App\Request $request

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

              }

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

                          }

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

               * @throws \App\Exceptions\Security

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

                  if (!$fieldModel->isCalculateField()) {

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

                      throw new \App\Exceptions\Security('ERR_NOT_SUPPORTED_FIELD', 406);

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

               *

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

                      $documentRecordModel = Vtiger_Record_Model::getInstanceById($records[0], $relatedModuleName);

          Line exceeds 120 characters; contains 171 characters
          Open

                      $result = ['notify' => ['text' => \App\Language::translate('LBL_FILE_NOT_AVAILABLE', $relatedModuleName) . ': <br>- ' . implode('<br>- ', $fileNotAvailable)]];

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

                          $relModules = ['Products', 'OutsourcedProducts', 'Assets', 'Services', 'OSSOutsourcedServices', 'OSSSoldServices'];

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

                              $totalCount += (int) $relationListView->getRelationQuery()->andWhere(['vtiger_activity.status' => Calendar_Module_Model::getComponentActivityStateLabel('current')])->count();

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

                          $pageLimit = $pagingModel->getPageLimit();

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

                      $result = $relationModel->updateFavoriteForRecord($request->getByType('actionMode'), ['crmid' => $request->getInteger('record'), 'relcrmid' => $request->getInteger('relcrmid')]);

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

                  $fieldQueryModel = $queryGenerator->getQueryField($request->getByType('fieldName', 2));

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

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

                      $categoryCount = ['Products', 'OutsourcedProducts', 'Services', 'OSSOutsourcedServices'];

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

                          $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relModule, $relationId, $cvId);

          Line exceeds 120 characters; contains 131 characters
          Open

                          $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relModule, $relationId, $cvId);

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

                          if ('Calendar' === $relatedModuleName && \App\Config::module($relatedModuleName, 'SHOW_ONLY_CURRENT_RECORDS_COUNT')) {

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

              public function updateFavoriteForRecord(App\Request $request)

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

                  if (!empty($relationModel)) {

          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\NotAllowedMethod('LBL_PERMISSION_DENIED', 406);

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

                  $fieldName = $fieldModel->getName();

          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 checkFilesIntegrity(App\Request $request)

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

                      $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

                  $result = [];

          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\Security('ERR_NO_ACCESS_TO_THE_FIELD', 403);

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

                  $relatedModuleName = $request->getByType('relatedModule', 2);

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

                  if (!empty($fileNotAvailable)) {

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

          class Vtiger_RelationAjax_Action extends \App\Controller\Action

          There are no issues that match your filters.

          Category
          Status