YetiForceCompany/YetiForceCRM

View on GitHub
modules/Home/models/Module.php

Summary

Maintainability
D
2 days
Test Coverage
F
1%

Function getCalendarActivities has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
    {
        $activities = [];
        $query = new \App\Db\Query();
        if (!$user) {
Severity: Minor
Found in modules/Home/models/Module.php - About 5 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

class Home_Module_Model extends Vtiger_Module_Model
{
    /**
     * Function returns the default view for the Home module.
     *
Severity: Minor
Found in modules/Home/models/Module.php by phpmd

Method getCalendarActivities has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
    {
        $activities = [];
        $query = new \App\Db\Query();
        if (!$user) {
Severity: Major
Found in modules/Home/models/Module.php - About 2 hrs to fix

    Method getAssignedProjectsTasks has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
        {
            $currentUser = Users_Record_Model::getCurrentUserModel();
            if (!$user) {
                $user = $currentUser->getId();
    Severity: Minor
    Found in modules/Home/models/Module.php - About 1 hr to fix

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

          public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
          {
              $currentUser = Users_Record_Model::getCurrentUserModel();
              if (!$user) {
                  $user = $currentUser->getId();
      Severity: Minor
      Found in modules/Home/models/Module.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 getHistory has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getHistory($pagingModel, $type = false)
          {
              if (empty($type)) {
                  $type = 'all';
              }
      Severity: Minor
      Found in modules/Home/models/Module.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 getHistory has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getHistory($pagingModel, $type = false)
          {
              if (empty($type)) {
                  $type = 'all';
              }
      Severity: Minor
      Found in modules/Home/models/Module.php - About 1 hr to fix

        Method getCalendarActivities has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
        Severity: Minor
        Found in modules/Home/models/Module.php - About 35 mins to fix

          The method getAssignedProjectsTasks() has an NPath complexity of 300. The configured NPath complexity threshold is 200.
          Open

              public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
              {
                  $currentUser = Users_Record_Model::getCurrentUserModel();
                  if (!$user) {
                      $user = $currentUser->getId();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          NPathComplexity

          Since: 0.1

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

          Example

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

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

          The method getCalendarActivities() has an NPath complexity of 3520. The configured NPath complexity threshold is 200.
          Open

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
              {
                  $activities = [];
                  $query = new \App\Db\Query();
                  if (!$user) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          NPathComplexity

          Since: 0.1

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

          Example

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

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

          The method getHistory() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
          Open

              public function getHistory($pagingModel, $type = false)
              {
                  if (empty($type)) {
                      $type = 'all';
                  }
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          NPathComplexity

          Since: 0.1

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

          Example

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

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

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

              public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
              {
                  $currentUser = Users_Record_Model::getCurrentUserModel();
                  if (!$user) {
                      $user = $currentUser->getId();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          CyclomaticComplexity

          Since: 0.1

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

          Example

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

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

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

              public function getHistory($pagingModel, $type = false)
              {
                  if (empty($type)) {
                      $type = 'all';
                  }
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          CyclomaticComplexity

          Since: 0.1

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

          Example

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

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

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

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
              {
                  $activities = [];
                  $query = new \App\Db\Query();
                  if (!$user) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          CyclomaticComplexity

          Since: 0.1

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

          Example

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

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

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

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

          See

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

              public function getHistory($pagingModel, $type = false)
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

          See

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

                  $query = new \App\Db\Query();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

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

                  $query = new \App\Db\Query();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

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

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

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

          Example

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

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

          Missing class import via use statement (line '251', column '17').
          Open

                      $query = new \App\Db\Query();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

          Missing class import via use statement (line '114', column '21').
          Open

                      $subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

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

              public function getHistory($pagingModel, $type = false)
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

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

          Example

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

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

          Missing class import via use statement (line '179', column '17').
          Open

                  $query = (new App\Db\Query())
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

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

              public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

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

          Example

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

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

          Missing class import via use statement (line '267', column '34').
          Open

                              $modTrackerRecorModel = new ModTracker_Record_Model();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          MissingImport

          Since: 2.7.0

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

          Example

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

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

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

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('sc_realted_to'));
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getCalendarActivities'.
          Open

                      if (!empty($row['parent_id']) && \App\Record::isExists($row['parent_id'])) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'vtlib\Functions' in method 'getAssignedProjectsTasks'.
          Open

                              $model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getCalendarActivities'.
          Open

                              if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['related_to'])) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                          $commentModel = Vtiger_Record_Model::getCleanInstance('ModComments');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Users_Record_Model' in method 'getAssignedProjectsTasks'.
          Open

                  $currentUser = Users_Record_Model::getCurrentUserModel();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                  } else {
                      $pagingModel->set('nextPageExists', false);
                  }
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getAssignedProjectsTasks'.
          Open

                          if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                  } else {
                      $pagingModel->set('nextPageExists', false);
                  }
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          ElseExpression

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\PrivilegeQuery' in method 'getComments'.
          Open

                  \App\PrivilegeQuery::getConditions($query, 'ModComments');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                          $record = Vtiger_Record_Model::getInstanceById($row['parent_id']);
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('linktoaccountscontacts'));
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      $modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\PrivilegeQuery' in method 'getCalendarActivities'.
          Open

                  \App\PrivilegeQuery::getConditions($query, 'Calendar');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'App\Fields\DateTime' in method 'getAssignedProjectsTasks'.
          Open

                  $nowInDBFormat = App\Fields\DateTime::formatToDb($nowInUserFormat);
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\PrivilegeQuery' in method 'getAssignedProjectsTasks'.
          Open

                  \App\PrivilegeQuery::getConditions($query, 'ProjectTask');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getAssignedProjectsTasks'.
          Open

                              $model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getAssignedProjectsTasks'.
          Open

                      if ($row['projectid'] && \App\Record::isExists($row['projectid'])) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      $model = Vtiger_Record_Model::getCleanInstance('Calendar');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getCalendarActivities'.
          Open

                              if (\App\Record::isExists($record->get('parent_id'))) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'getCalendarActivities'.
          Open

                      $user = \App\User::getCurrentUserId();
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                          $record = Vtiger_Record_Model::getInstanceById($row['projectid'], 'Project');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'getCalendarActivities'.
          Open

                      if (\App\User::isExists($userId)) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      $model = Vtiger_Record_Model::getCleanInstance('ProjectTask');
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                          if (\App\Privilege::isPermitted($moduleName, 'DetailView', $recordId)) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\User' in method 'getCalendarActivities'.
          Open

                          $userModel = \App\User::getUserModel($userId);
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Record' in method 'getCalendarActivities'.
          Open

                              if (\App\Record::isExists($record->get('sc_realted_to'))) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('parent_id'));
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'App\Fields\DateTime' in method 'getAssignedProjectsTasks'.
          Open

                  $nowInUserFormat = App\Fields\DateTime::formatToDisplay(date('Y-m-d H:i:s'));
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

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

                      $pagingModel->set('nextPageExists', true);
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      $subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      if (!empty($row['parent_id']) && \App\Record::isExists($row['parent_id'])) {
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

          Define a constant instead of duplicating this literal "vtiger_crmentity.smownerid" 6 times.
          Open

                  $query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                  \App\PrivilegeQuery::getConditions($query, 'ModComments');
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      if ($row['projectid'] && \App\Record::isExists($row['projectid'])) {
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                              $model->set('contractor', $record);
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                  $query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      $query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['related_to'])) {
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_modcomments.modcommentsid = vtiger_crmentity.crmid')
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

          Define a constant instead of duplicating this literal "linktoaccountscontacts" 6 times.
          Open

                              if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                  $query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      ->where(['vtiger_crmentity.deleted' => 0, 'crmentity2.deleted' => 0]);
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                      $query->andWhere(['>=', 'targetenddate', $currentDate]);
          Severity: Critical
          Found in modules/Home/models/Module.php by sonar-php

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                  foreach ($history as $time => $model) {
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          UnusedLocalVariable

          Since: 0.2

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

          Example

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

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

          Avoid unused parameters such as '$recordId'.
          Open

              public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          UnusedFormalParameter

          Since: 0.2

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

          Example

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

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

          Avoid unused parameters such as '$recordId'.
          Open

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          UnusedFormalParameter

          Since: 0.2

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

          Example

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

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

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

                  $query->orderBy(['vtiger_modcomments.modcommentsid' => SORT_DESC])
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

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

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

                      $query->orderBy(['vtiger_modtracker_basic.id' => SORT_DESC])
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                  $dataReader->close();
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Default value for string $type can't be false
          Open

              public function getHistory($pagingModel, $type = false)
          Severity: Minor
          Found in modules/Home/models/Module.php by phan

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

                      $query->select(['vtiger_modtracker_basic.*'])
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                      $subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                  if ($dataReader->count() > $pagingModel->getPageLimit()) {
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                  $query = (new App\Db\Query())
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Saw unextractable annotation for comment '* @return <array>'</array>
          Open

               * @return <Array>
          Severity: Info
          Found in modules/Home/models/Module.php by phan

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

                      $dataReader->close();
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

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

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

                  $dataReader->close();
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                  $query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['and', ['vtiger_crmentity.smcreatorid' => $paramsMore['user']], ['NOT IN', 'vtiger_crmentity.smownerid', $paramsMore['user']]]);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['vtiger_activity.activitytype' => $paramsMore['activitytype']]);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      $user = \App\User::getCurrentUserId();
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                  $pagingModel->calculatePageRange($dataReader->count());
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['or', ['vtiger_crmentity.smownerid' => $userAndGroups], ['vtiger_crmentity.crmid' => $subQuery]]);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Default value for string $recordId can't be false
          Open

              public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
          Severity: Minor
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['<>', 'module', 'ModComments']);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Default value for string $recordId can't be false
          Open

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
          Severity: Minor
          Found in modules/Home/models/Module.php by phan

          Returning type false but getHistory() is declared to return array
          Open

                  return false;
          Severity: Minor
          Found in modules/Home/models/Module.php by phan

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

                  $query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Call to method getUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                          $userModel = \App\User::getUserModel($userId);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Saw unextractable annotation for comment '* @param <vtiger_paging_model> $pagingModel'</vtiger_paging_model>
          Open

               * @param <Vtiger_Paging_Model> $pagingModel
          Severity: Info
          Found in modules/Home/models/Module.php by phan

          Suspicious array access to null
          Open

                      $userAndGroups[] = $userId;
          Severity: Minor
          Found in modules/Home/models/Module.php by phan

          Call to method getInstance from undeclared class \App\Fields\Owner
          Open

                  $accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

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

          Call to method getInstance from undeclared class \App\Fields\Owner
          Open

                  $accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Call to method isExists from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      if (\App\User::isExists($userId)) {
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Saw unextractable annotation for comment '* @return <array>'</array>
          Open

               * @return <Array>
          Severity: Info
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                      $query->andWhere(['vtiger_activity.priority' => $paramsMore['taskpriority']]);
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

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

                  $query->orderBy($pagingModel->get('orderby'))
          Severity: Critical
          Found in modules/Home/models/Module.php by phan

          Saw unextractable annotation for comment '* @param <vtiger_paging_model> $pagingModel - $pagingModel'</vtiger_paging_model>
          Open

               * @param <Vtiger_Paging_Model> $pagingModel - $pagingModel
          Severity: Info
          Found in modules/Home/models/Module.php by phan

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

          class Home_Module_Model extends Vtiger_Module_Model

          The class Home_Module_Model is not named in CamelCase.
          Open

          class Home_Module_Model extends Vtiger_Module_Model
          {
              /**
               * Function returns the default view for the Home module.
               *
          Severity: Minor
          Found in modules/Home/models/Module.php by phpmd

          CamelCaseClassName

          Since: 0.2

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

          Example

          class class_name {
          }

          Source

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

               */

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

                          $time = $commentModel->get('createdtime');

          Line exceeds 120 characters; contains 174 characters
          Open

                  $query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])

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

                      'parentId' => 'crmentity2.crmid', 'parentModule' => 'crmentity2.setype', ])

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

                      if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['related_to'])) {

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

               * @param Vtiger_Paging_Model $pagingModel - $pagingModel

          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 \Vtiger_Paging_Model $pagingModel

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

                  \App\PrivilegeQuery::getConditions($query, 'ModComments');

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

               * @return \Vtiger_Record_Model[]

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

               *

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

                      ->offset($pagingModel->getStartIndex());

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

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])

          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->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);

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

               * @param string              $recordId    - record id

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

               *

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

               * @param mixed               $paramsMore

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

               *

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_activity.activityid')

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

                  \App\PrivilegeQuery::getConditions($query, 'Calendar');

          Line exceeds 120 characters; contains 158 characters
          Open

                      $query->andWhere(['and', ['vtiger_crmentity.smcreatorid' => $paramsMore['user']], ['NOT IN', 'vtiger_crmentity.smownerid', $paramsMore['user']]]);

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

                  }

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

              /**

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_modcomments.modcommentsid = vtiger_crmentity.crmid')

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

                          $comments[$time] = $commentModel;

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

                  }

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

               * @param string              $user        - all/userid

          Line exceeds 120 characters; contains 126 characters
          Open

                      $query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);

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

               * @return string

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

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

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

              {

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

                  if ('upcoming' === $mode || 'overdue' === $mode) {

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

               * Function returns latest comments across CRM.

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

                          $commentModel = Vtiger_Record_Model::getCleanInstance('ModComments');

          Line exceeds 120 characters; contains 126 characters
          Open

              public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])

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

                      $query->andWhere(['vtiger_activity.activitytype' => $paramsMore['activitytype']]);

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

              /**

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

                      ->limit($pagingModel->getPageLimit())

          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

                  $query = new \App\Db\Query();

          Line exceeds 120 characters; contains 126 characters
          Open

                      $query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);

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

                  $query->orderBy(['vtiger_modcomments.modcommentsid' => SORT_DESC])

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

               * @param \App\Db\Query $query

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

              }

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

              /**

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

               * @return array

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

               */

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

               * Function returns the default view for the Home module.

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

                  $query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',

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

                  $comments = [];

          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 returns the Calendar Events for the module.

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

              {

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

                      ->where(['vtiger_crmentity.deleted' => 0]);

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

                  return 'DashBoard';

          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 getComments($pagingModel)

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

                  $query = new \App\Db\Query();

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

                  $dataReader = $query->createCommand()->query();

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

               * @param string        $type

          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->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])

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

                      $query->andWhere(['and', ['vtiger_crmentity.smcreatorid' => $paramsMore['user']], ['NOT IN', 'vtiger_crmentity.smownerid', $paramsMore['user']]]);

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

               * Function returns part of the query to  fetch only  activity.

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

               *

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

                  $activities = [];

          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 ('createdByMeButNotMine' === $mode || 'createdByMeButNotMineOverdue' === $mode) {

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

                  if (isset($paramsMore['activitytype'])) {

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

              public function getDefaultViewName()

          Line exceeds 120 characters; contains 129 characters
          Open

                  $query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',

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

                      ->innerJoin('vtiger_crmentity crmentity2', 'vtiger_modcomments.related_to = crmentity2.crmid')

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

                      ->where(['vtiger_crmentity.deleted' => 0, 'crmentity2.deleted' => 0]);

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

                  $dataReader->close();

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

                  return $comments;

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

                      $user = \App\User::getCurrentUserId();

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

                      ->from('vtiger_activity')

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

                      ->from('vtiger_modcomments')

          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

                          $commentModel->setData($row);

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

              public function getActivityQuery(App\Db\Query $query, $type)

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

                  if ('updates' == $type) {

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

                      $query->andWhere(['<>', 'module', 'ModComments']);

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

               * @param string              $mode        - upcoming/overdue mode

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

                  if (!$user) {

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

                      $query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);

          Line exceeds 120 characters; contains 244 characters
          Open

                      $subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');

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

                  $query->orderBy($pagingModel->get('orderby'))

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

                  $dataReader = $query->createCommand()->query();

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

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

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

                      }

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

                      $activities[] = $model;

          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

               * Function returns comments and recent activities across module.

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

               * @param <Vtiger_Paging_Model> $pagingModel

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

                  if (empty($type)) {

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

                          $comments = $this->getComments($pagingModel);

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

                      $model = Vtiger_Record_Model::getCleanInstance('Calendar');

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

                              if (\App\Record::isExists($record->get('parent_id'))) {

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

               *

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

                      ->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_projecttask.*'])

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

                      $query->andWhere(['>=', 'targetenddate', $currentDate]);

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

                  if ('all' != $user && '' != $user && (\array_key_exists($user, $accessibleUsers) || \array_key_exists($user, $accessibleGroups))) {

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

                  $query->orderBy('targetenddate')

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

                      ->limit($pagingModel->getPageLimit() + 1)

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

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

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

                  $dataReader->close();

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

               *

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

              {

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

                      if ('comments' == $type) {

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

                          return $comments;

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

                  if (isset($paramsMore['taskpriority'])) {

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

                  if ('all' !== $user && !empty($user)) {

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

                      $model->setData($row);

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

                          $record = Vtiger_Record_Model::getInstanceById($row['parent_id']);

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

                                  $model->set('contractor', $recordContractor);

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

                      $pagingModel->set('nextPageExists', false);

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

                  }

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

               * Function returns the Calendar Events for the module.

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

               * @param <Vtiger_Paging_Model> $pagingModel - $pagingModel

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

                      $query->andWhere(['vtiger_crmentity.smownerid' => $user]);

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

                  }

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

               * @return <Array>

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

                      }

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

                              }

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

                  } else {

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

               * @param string                $mode        - upcoming/overdue mode

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

               * @return <Array>

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

              {

          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

                  }

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

                          $userModel = \App\User::getUserModel($userId);

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

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('linktoaccountscontacts'));

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

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

                  }

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

                  $accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();

          Line exceeds 120 characters; contains 139 characters
          Open

                  if ('all' != $user && '' != $user && (\array_key_exists($user, $accessibleUsers) || \array_key_exists($user, $accessibleGroups))) {

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

                      if (\App\User::isExists($userId)) {

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

                      }

          Line exceeds 120 characters; contains 121 characters
          Open

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('linktoaccountscontacts'));

          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

                      $query->andWhere(['<', 'targetenddate', $currentDate]);

          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

                          $userAndGroups = $userModel->getGroups();

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

                  if ($dataReader->count() > $pagingModel->getPageLimit()) {

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

                      $pagingModel->set('nextPageExists', true);

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

                  }

          Line exceeds 120 characters; contains 295 characters
          Open

                              $model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');

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

                  $comments = [];

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

                  //As getComments api is used to get comment infomation,no need of getting

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

                      if (!empty($row['parent_id']) && \App\Record::isExists($row['parent_id'])) {

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

                  $pagingModel->calculatePageRange($dataReader->count());

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

              /**

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

               *

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

                  $nowInDBFormat = App\Fields\DateTime::formatToDb($nowInUserFormat);

          Line exceeds 120 characters; contains 129 characters
          Open

                      ->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_projecttask.*'])

          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 ($dataReader->count() > $pagingModel->getPageLimit()) {

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

                      array_pop($projecttasks);

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

                      }

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

                  //updateActivityQuery api is used to update a query to fetch a only activity

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

                      $userId = (int) $user;

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

                      $query->andWhere(['or', ['vtiger_crmentity.smownerid' => $userAndGroups], ['vtiger_crmentity.crmid' => $subQuery]]);

          Line exceeds 120 characters; contains 128 characters
          Open

                      $query->andWhere(['or', ['vtiger_crmentity.smownerid' => $userAndGroups], ['vtiger_crmentity.crmid' => $subQuery]]);

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

                      ->limit($pagingModel->getPageLimit() + 1)

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

                                  $model->set('contractor', $recordContractor);

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

                              if (\App\Record::isExists($record->get('sc_realted_to'))) {

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

                  $dataReader->close();

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

                      ->offset($pagingModel->getStartIndex());

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

                          if ('Accounts' === $record->getModuleName()) {

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

                  return $activities;

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

                  } elseif ('overdue' === $mode) {

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

                  \App\PrivilegeQuery::getConditions($query, 'ProjectTask');

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

                          $record = Vtiger_Record_Model::getInstanceById($row['projectid'], 'Project');

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

                      ->offset($pagingModel->getStartIndex());

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

                      $model = Vtiger_Record_Model::getCleanInstance('ProjectTask');

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

                      $model->setId($row['crmid']);

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

                                  $model->set('contractor', $recordContractor);

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

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('parent_id'));

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

                      array_pop($activities);

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

              public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)

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

                      $user = $currentUser->getId();

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

                  if ('upcoming' === $mode) {

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

                      $pagingModel->set('nextPageExists', false);

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

                  return $projecttasks;

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

                      }

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

                      $subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');

          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 string                $user        - all/userid

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

                  $nowInUserFormat = App\Fields\DateTime::formatToDisplay(date('Y-m-d H:i:s'));

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

                      ->from('vtiger_projecttask')

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

                      $projecttasks[] = $model;

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

                      $userAndGroups[] = $userId;

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

                              $model->set('contractor', $record);

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

                              if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {

          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 ('ServiceContracts' === $record->getModuleName()) {

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_projecttask.projecttaskid')

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

                  $dataReader = $query->createCommand()->query();

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

               * @param string                $recordId    - record id

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

                  [$currentDate] = explode(' ', $nowInDBFormat);

          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 ($row['projectid'] && \App\Record::isExists($row['projectid'])) {

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

               * @param string                $type        - comments, updates or all

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

              public function getHistory($pagingModel, $type = false)

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

                      $type = 'all';

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

                  //comment information again,so avoiding from modtracker

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

                      $query->andWhere(['vtiger_activity.priority' => $paramsMore['taskpriority']]);

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

                          } elseif ('Project' === $record->getModuleName()) {

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

                                  $recordContractor = Vtiger_Record_Model::getInstanceById($record->get('sc_realted_to'));

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

                  $currentUser = Users_Record_Model::getCurrentUserModel();

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

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

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

                      ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smcreatorid' => $currentUser->getId()]);

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

                      $model->setData($row);

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

                              $model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');

          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 ('HelpDesk' === $record->getModuleName()) {

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

                  $accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();

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

                  $projecttasks = [];

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

                      $model->setId($row['crmid']);

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

                          if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {

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

                  $pagingModel->calculatePageRange($dataReader->count());

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

                      $pagingModel->set('nextPageExists', true);

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

                  if ('all' == $type || 'comments' == $type) {

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

                      $modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');

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

                      if ($modCommentsModel->isPermitted('DetailView')) {

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

                  if ('updates' == $type || 'all' == $type) {

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

                      $activites = [];

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

                      $this->getActivityQuery($query, $type);

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

                          $moduleName = $row['module'];

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

                  }

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

              }

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

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

          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 = new \App\Db\Query();

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

                          ->offset($pagingModel->getStartIndex());

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

                  $history = array_merge($activites, $comments);

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

                          ->innerJoin('vtiger_crmentity', 'vtiger_modtracker_basic.crmid = vtiger_crmentity.crmid')

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

                      $query->orderBy(['vtiger_modtracker_basic.id' => SORT_DESC])

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

                  }

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

                  return false;

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

                          ->from('vtiger_modtracker_basic')

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

                      $dataReader->close();

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

                      $query->select(['vtiger_modtracker_basic.*'])

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

                              $modTrackerRecorModel = new ModTracker_Record_Model();

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

                      array_multisort($dateTime, SORT_DESC, SORT_STRING, $history);

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

                          }

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

                              $modTrackerRecorModel->setData($row)->setParent($recordId, $moduleName);

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

                          $recordId = $row['crmid'];

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

                  }

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

                  $dateTime = [];

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

                      $dateTime[] = $time;

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

                      return $history;

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

                  foreach ($history as $time => $model) {

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

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

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

                              $activites[$time] = $modTrackerRecorModel;

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

                  if (!empty($history)) {

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

                          ->where(['vtiger_crmentity.deleted' => 0]);

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

                      $dataReader = $query->createCommand()->query();

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

                          ->limit($pagingModel->getPageLimit())

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

                              $time = $modTrackerRecorModel->get('changedon');

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

          class Home_Module_Model extends Vtiger_Module_Model

          There are no issues that match your filters.

          Category
          Status