YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/widgets/HistoryRelation.php

Summary

Maintainability
C
7 hrs
Test Coverage
F
5%

Method getQuery has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getQuery($recordId, $moduleName, $type)
    {
        $queries = [];
        $db = App\Db::getInstance();
        if (\in_array('Calendar', $type) && ($field = current(\Vtiger_Module_Model::getInstance('Calendar')->getReferenceFieldsForModule($moduleName)))) {
Severity: Major
Found in modules/Vtiger/widgets/HistoryRelation.php - About 3 hrs to fix

    Function getQuery has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getQuery($recordId, $moduleName, $type)
        {
            $queries = [];
            $db = App\Db::getInstance();
            if (\in_array('Calendar', $type) && ($field = current(\Vtiger_Module_Model::getInstance('Calendar')->getReferenceFieldsForModule($moduleName)))) {
    Severity: Minor
    Found in modules/Vtiger/widgets/HistoryRelation.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 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getHistory(App\Request $request, Vtiger_Paging_Model $pagingModel)
        {
            $recordId = $request->getInteger('record');
            if ($request->isEmpty('type')) {
                return [];
    Severity: Minor
    Found in modules/Vtiger/widgets/HistoryRelation.php - About 1 hr to fix

      Function getHistory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getHistory(App\Request $request, Vtiger_Paging_Model $pagingModel)
          {
              $recordId = $request->getInteger('record');
              if ($request->isEmpty('type')) {
                  return [];
      Severity: Minor
      Found in modules/Vtiger/widgets/HistoryRelation.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

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

      class Vtiger_HistoryRelation_Widget extends Vtiger_Basic_Widget
      {
          /**
           * Names od classes that define color.
           *

      CouplingBetweenObjects

      Since: 1.1.0

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

      Example

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

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

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),

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

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

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

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

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

                          'type' => new \yii\db\Expression($db->quoteValue('ModComments')),

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

                      $sql = (new \App\Db\Query())->from(['records' => $subQuery]);

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

                          'type' => new \yii\db\Expression($db->quoteValue('Calendar')),

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),

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

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

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

                          'type' => new \yii\db\Expression('CONCAT(\'OSSMailView\', vtiger_ossmailview.ossmailview_sendtype)'),

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '144', column '20').
      Open

                          'time' => new \yii\db\Expression('CONCAT(vtiger_activity.date_start, ' . $db->quoteValue(' ') . ', vtiger_activity.time_start)'),

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

              return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showRecentRelation&page=1&limit=' . $this->Data['limit'] . '&type=' . \App\Json::encode(self::getActions());

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                      $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body)));

      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\Db' in method 'getQuery'.
      Open

              $db = App\Db::getInstance();

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

                  } else {
                      $row['url'] = Vtiger_Module_Model::getInstance($row['type'])->getDetailViewUrl($row['id']);
                  }

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

                  } else {
                      $row['isGroup'] = false;
                      $row['userModel'] = Vtiger_Record_Model::getInstanceById($row['user'], 'Users');
                  }

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

                      $row['userModel'] = Vtiger_Record_Model::getInstanceById($row['user'], 'Users');

      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\TextUtils' in method 'getHistory'.
      Open

                      $body = nl2br(App\TextUtils::textTruncate($body, 500), false);

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

                  if (!\App\Privilege::isPermitted($module)) {

      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 'Settings_Groups_Record_Model' in method 'getHistory'.
      Open

              $groups = Settings_Groups_Record_Model::getAll();

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  $body = trim(App\Purifier::purify($row['body']));

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

                  } else {
                      $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body)));
                      $body = nl2br(App\TextUtils::textTruncate($body, 500), false);
                  }

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

                  } else {
                      return false;
                  }

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

          public static function getQuery($recordId, $moduleName, $type)
          {
              $queries = [];
              $db = App\Db::getInstance();
              if (\in_array('Calendar', $type) && ($field = current(\Vtiger_Module_Model::getInstance('Calendar')->getReferenceFieldsForModule($moduleName)))) {

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

                      $body = App\TextUtils::textTruncate($body, 100);

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                      $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body)));

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

                  \App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $recordId);

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

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

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

              } else {
                  $subQuery = reset($queries);
                  $index = 0;
                  foreach ($queries as $query) {
                      if (0 !== $index) {

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

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

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

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

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

                          'user' => 'vtiger_crmentity.smownerid',

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

              'Calendar' => 'bg-warning',

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

              $modules = ['ModComments', 'OSSMailView', 'Calendar'];

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

                          'content' => 'vtiger_activity.subject',

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

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

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

              'ModComments' => 'bg-primary',

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),

      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.

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'type' => new \yii\db\Expression($db->quoteValue('ModComments')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'type' => new \yii\db\Expression('CONCAT(\'OSSMailView\', vtiger_ossmailview.ossmailview_sendtype)'),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

      Returning type false but getQuery() is declared to return \App\Db\Query
      Open

                      return false;

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

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

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'type' => new \yii\db\Expression($db->quoteValue('Calendar')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'time' => new \yii\db\Expression('CONCAT(vtiger_activity.date_start, ' . $db->quoteValue(' ') . ', vtiger_activity.time_start)'),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

      Reference to undeclared property \Vtiger_HistoryRelation_Widget->Data
      Open

              return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showRecentRelation&page=1&limit=' . $this->Data['limit'] . '&type=' . \App\Json::encode(self::getActions());

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

                          'type' => new \yii\db\Expression($db->quoteValue('Calendar')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                  $query = (new \App\Db\Query())
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                  $query = (new \App\Db\Query())
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                      $sql = (new \App\Db\Query())->from(['records' => $subQuery]);
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

      Saw a token Phan may have failed to parse after '* @return \App\Db\Query()|false': after \App\Db\Query, saw '('
      Open

           * @return \App\Db\Query()|false

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'type' => new \yii\db\Expression($db->quoteValue('ModComments')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

      Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
      Open

              return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showRecentRelation&page=1&limit=' . $this->Data['limit'] . '&type=' . \App\Json::encode(self::getActions());

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

              $query->limit($pageLimit)->offset($startIndex);
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                  $query = (new \App\Db\Query())
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'time' => new \yii\db\Expression('CONCAT(vtiger_activity.date_start, ' . $db->quoteValue(' ') . ', vtiger_activity.time_start)'),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

      Call to undeclared method \Vtiger_Module_Model::getPreviewViewUrl
      Open

                      $row['url'] = Vtiger_Module_Model::getInstance('OSSMailView')->getPreviewViewUrl($row['id']);
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),
      Severity: Critical
      Found in modules/Vtiger/widgets/HistoryRelation.php by phan

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

      class Vtiger_HistoryRelation_Widget extends Vtiger_Basic_Widget

      The class Vtiger_HistoryRelation_Widget is not named in CamelCase.
      Open

      class Vtiger_HistoryRelation_Widget extends Vtiger_Basic_Widget
      {
          /**
           * Names od classes that define color.
           *

      CamelCaseClassName

      Since: 0.2

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

      Example

      class class_name {
      }

      Source

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

              $db = App\Db::getInstance();

      ShortVariable

      Since: 0.2

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

      Example

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

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

      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

          public static function getActions()

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

                      unset($modules[$key]);

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

           * Names od classes that define color.

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

              'ModComments' => 'bg-primary',

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

              'OSSMailViewSent' => 'bg-success',

      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

              'OSSMailViewReceived' => 'bg-danger',

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

              return $modules;

      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

              'OSSMailViewInternal' => 'bg-primary',

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

                  if (!\App\Privilege::isPermitted($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

              'Calendar' => 'bg-warning',

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

          ];

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

              $modules = ['ModComments', 'OSSMailView', 'Calendar'];

      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 static $colors = [

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

           * Function gets modules name.

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

              foreach ($modules as $key => $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

              return 'HistoryRelationConfig';

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

                  return [];

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

              $startIndex = $pagingModel->getStartIndex();

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

                      $row['isGroup'] = false;

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

              $queries = [];

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),

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

                  $queries[] = $query;

      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

                  foreach ($queries as $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

              $query->limit($pageLimit)->offset($startIndex);

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

                  if (\in_array($row['user'], $groupIds)) {

      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 $moduleName

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

           * @param array  $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

                          'user' => 'vtiger_crmentity.smownerid',

      Line exceeds 120 characters; contains 149 characters
      Open

                          'time' => new \yii\db\Expression('CONCAT(vtiger_activity.date_start, ' . $db->quoteValue(' ') . ', vtiger_activity.time_start)'),

      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

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

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

                          'attachments_exist',

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

                  $sql = reset($queries);

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

           * @var string[]

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

              $this->Config['url'] = $this->getUrl();

      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 creates database query in order to get records for timeline widget.

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

              if (\in_array('Calendar', $type) && ($field = current(\Vtiger_Module_Model::getInstance('Calendar')->getReferenceFieldsForModule($moduleName)))) {

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

                      ])

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

                  \App\PrivilegeQuery::getConditions($query, 'ModComments', false, $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

          /**

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

              }

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

                  $row['body'] = $body;

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

                          'body' => new \yii\db\Expression($db->quoteValue('')),

      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

                      ])

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

                  $queries[] = $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

                  } else {

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

                      $row['url'] = Vtiger_Module_Model::getInstance($row['type'])->getDetailViewUrl($row['id']);

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

                  $body = trim(App\Purifier::purify($row['body']));

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

                      ->select([

      Line exceeds 120 characters; contains 121 characters
      Open

                          'type' => new \yii\db\Expression('CONCAT(\'OSSMailView\', vtiger_ossmailview.ossmailview_sendtype)'),

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

                      ->from('vtiger_ossmailview')

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

                      }

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

                      $sql = (new \App\Db\Query())->from(['records' => $subQuery]);

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

              return $this->Config;

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

          public function getConfigTplName()

      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 - List of records

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

                  } else {

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

                  }

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

           * @param int    $recordId

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),

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

                          'content' => 'vtiger_activity.subject',

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

                  \App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $recordId);

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

                  $index = 0;

      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

          public function getUrl()

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

          {

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

              if (empty($query)) {

      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

                      $body = nl2br(App\TextUtils::textTruncate($body, 500), false);

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

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

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

                          'type' => new \yii\db\Expression($db->quoteValue('ModComments')),

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

                          'user' => 'vtiger_crmentity.smownerid',

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

                          'id' => 'vtiger_ossmailview.ossmailviewid',

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

                          'time' => 'vtiger_crmentity.createdtime',

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

                  return [];

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

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

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

                  $row['class'] = self::$colors[$row['type']];

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

                      $row['url'] = Vtiger_Module_Model::getInstance('OSSMailView')->getPreviewViewUrl($row['id']);

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

                      ->andWhere(['=', 'vtiger_activity.' . $field->getColumnName(), $recordId]);

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

                      if (0 !== $index) {

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

                          $subQuery->union($query, true);

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

                  }

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

                      return false;

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

          }

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

                  }

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

              $this->Config['tpl'] = 'HistoryRelation.tpl';

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

                      $row['userModel'] = $groups[$row['user']];

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

                      $body = App\TextUtils::textTruncate($body, 100);

      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

                          'id' => 'vtiger_crmentity.crmid',

      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

                      ->from('vtiger_modcomments')

      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

           */

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

           *

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

              $history = [];

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

                          'content' => 'vtiger_modcomments.commentcontent',

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

                          'user' => 'vtiger_crmentity.smownerid',

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

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

      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

                  $subQuery = reset($queries);

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

          }

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

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

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

              $pageLimit = $pagingModel->getPageLimit();

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

              $groupIds = array_keys($groups);

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

                  if (false !== strpos($row['type'], 'OSSMailView')) {

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

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

           * @return \App\Db\Query()|false

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

                          'attachments_exist' => new \yii\db\Expression($db->quoteValue('')),

      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([

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

                  if ($subQuery) {

      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 = static::getQuery($recordId, $request->getModule(), $request->getArray('type', 'Alnum'));

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

              $groups = Settings_Groups_Record_Model::getAll();

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

                      $row['type'] = 'OSSMailView';

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

              }

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

           * Get URL.

      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

           *

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

              }

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

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

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

                          'time' => 'vtiger_crmentity.createdtime',

      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

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

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

                  if (!$request->getBoolean('isFullscreen')) {

      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

                  $history[] = $row;

      Line exceeds 120 characters; contains 154 characters
      Open

              if (\in_array('Calendar', $type) && ($field = current(\Vtiger_Module_Model::getInstance('Calendar')->getReferenceFieldsForModule($moduleName)))) {

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

                          'type' => new \yii\db\Expression('CONCAT(\'OSSMailView\', vtiger_ossmailview.ossmailview_sendtype)'),

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

                      ++$index;

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

              return $sql->orderBy(['time' => 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

          public static function getHistory(App\Request $request, Vtiger_Paging_Model $pagingModel)

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

                      $row['isGroup'] = true;

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

                      $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body)));

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

           */

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

                  $queries[] = $query;

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

              if (\in_array('ModComments', $type)) {

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

                      ->andWhere(['=', 'r.crmid', $recordId]);

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

              return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showRecentRelation&page=1&limit=' . $this->Data['limit'] . '&type=' . \App\Json::encode(self::getActions());

      Line exceeds 120 characters; contains 199 characters
      Open

              return 'module=' . $this->Module . '&view=Detail&record=' . $this->Record . '&mode=showRecentRelation&page=1&limit=' . $this->Data['limit'] . '&type=' . \App\Json::encode(self::getActions());

      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

           *

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

          public static function getQuery($recordId, $moduleName, $type)

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

              $db = App\Db::getInstance();

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

                      ->select([

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

                          'time' => new \yii\db\Expression('CONCAT(vtiger_activity.date_start, ' . $db->quoteValue(' ') . ', vtiger_activity.time_start)'),

      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

                          'id' => 'vtiger_modcomments.modcommentsid',

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

                      ->andWhere(['=', 'vtiger_modcomments.related_to', $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

              if (\in_array('OSSMailView', $type)) {

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

                          'body' => 'vtiger_ossmailview.content',

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_ossmailview.ossmailviewid')

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

                      ->innerJoin('vtiger_ossmailview_relation r', 'r.ossmailviewid = vtiger_ossmailview.ossmailviewid ')

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

      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 gets records for timeline widget.

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

           * @param \App\Request        $request

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

                      $row['userModel'] = Vtiger_Record_Model::getInstanceById($row['user'], 'Users');

      Line exceeds 120 characters; contains 147 characters
      Open

                      $body = str_replace(['<p></p>', '<p class="MsoNormal">'], ["\r\n", "\r\n"], App\Purifier::decodeHtml(App\Purifier::purify($body)));

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

                          'type' => new \yii\db\Expression($db->quoteValue('Calendar')),

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

                          'content' => 'vtiger_ossmailview.subject',

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

              }

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

      class Vtiger_HistoryRelation_Widget extends Vtiger_Basic_Widget

      There are no issues that match your filters.

      Category
      Status