YetiForceCompany/YetiForceCRM

View on GitHub
app/RecordSearch.php

Summary

Maintainability
C
1 day
Test Coverage
F
33%

Function getSearchLabelQuery has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSearchLabelQuery(): Db\Query
    {
        $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
            ->from('u_#__crmentity_search_label csl')
            ->innerJoin('vtiger_tab', 'csl.tabid = vtiger_tab.tabid')
Severity: Minor
Found in app/RecordSearch.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function getSearchLabelQuery(): Db\Query
    {
        $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
            ->from('u_#__crmentity_search_label csl')
            ->innerJoin('vtiger_tab', 'csl.tabid = vtiger_tab.tabid')
Severity: Major
Found in app/RecordSearch.php - About 2 hrs to fix

    Method getLabelQuery has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getLabelQuery(): Db\Query
        {
            $query = (new \App\Db\Query())->select(['cl.crmid', 'cl.label', 'vtiger_crmentity.setype'])
                ->from('u_#__crmentity_label cl')->innerJoin('vtiger_crmentity', 'cl.crmid = vtiger_crmentity.crmid');
            $where = ['and'];
    Severity: Minor
    Found in app/RecordSearch.php - About 1 hr to fix

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

          public function getLabelQuery(): Db\Query
          {
              $query = (new \App\Db\Query())->select(['cl.crmid', 'cl.label', 'vtiger_crmentity.setype'])
                  ->from('u_#__crmentity_label cl')->innerJoin('vtiger_crmentity', 'cl.crmid = vtiger_crmentity.crmid');
              $where = ['and'];
      Severity: Minor
      Found in app/RecordSearch.php - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      The method getSearchLabelQuery() has an NPath complexity of 780. The configured NPath complexity threshold is 200.
      Open

          public function getSearchLabelQuery(): Db\Query
          {
              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
                  ->from('u_#__crmentity_search_label csl')
                  ->innerJoin('vtiger_tab', 'csl.tabid = vtiger_tab.tabid')
      Severity: Minor
      Found in app/RecordSearch.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 getSearchLabelQuery() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
      Open

          public function getSearchLabelQuery(): Db\Query
          {
              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
                  ->from('u_#__crmentity_search_label csl')
                  ->innerJoin('vtiger_tab', 'csl.tabid = vtiger_tab.tabid')
      Severity: Minor
      Found in app/RecordSearch.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 26 to the 15 allowed.
      Open

          public function getSearchLabelQuery(): Db\Query
      Severity: Critical
      Found in app/RecordSearch.php by sonar-php

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

      See

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

      class RecordSearch
      {
          /** @var string Table name for search mechanisms */
          public const SEARCH_TABLE_NAME = 'u_#__crmentity_search_label';
      
      
      Severity: Minor
      Found in app/RecordSearch.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

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

      Example

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

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

      Missing class import via use statement (line '258', column '15').
      Open

              return (new \Vtiger_Field_Model())->set('name', 'search')->set('uitype', 1)->set('typeofdata', 'V~O')->set('maximumlength', 255);
      Severity: Minor
      Found in app/RecordSearch.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 __construct has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function __construct($searchValue, $moduleName = false, int $limit = null)
      Severity: Minor
      Found in app/RecordSearch.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 '161', column '41').
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(csl.searchlabel) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $word . '*'])]);
      Severity: Minor
      Found in app/RecordSearch.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 '315', column '25').
      Open

              $queryGenerator = new \App\QueryGenerator($moduleName, $userId);
      Severity: Minor
      Found in app/RecordSearch.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 '159', column '27').
      Open

                          $query->andWhere(new \yii\db\Expression('1=0'));
      Severity: Minor
      Found in app/RecordSearch.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 '177', column '26').
      Open

                          $conditions[] = new \yii\db\Expression("MATCH(csl.searchlabel) AGAINST(:findvalue{$key} IN BOOLEAN MODE)", [":findvalue{$key}" => $word]);
      Severity: Minor
      Found in app/RecordSearch.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 '217', column '17').
      Open

              $query = (new \App\Db\Query())->select(['cl.crmid', 'cl.label', 'vtiger_crmentity.setype'])
      Severity: Minor
      Found in app/RecordSearch.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 '235', column '41').
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue . '*'])]);
      Severity: Minor
      Found in app/RecordSearch.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 '240', column '41').
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue])]);
      Severity: Minor
      Found in app/RecordSearch.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 '340', column '22').
      Open

              $dataReader = (new \App\Db\Query())->select(['vtiger_tab.name'])->from('vtiger_entityname')
      Severity: Minor
      Found in app/RecordSearch.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 '179', column '41').
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression(implode('+', $matcher), $params)]);
      Severity: Minor
      Found in app/RecordSearch.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 '\App\Purifier' in method 'getSearchResult'.
      Open

                  $row['label'] = \App\Purifier::decodeHtml($labels[$row['crmid']]);
      Severity: Minor
      Found in app/RecordSearch.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 'getSearchResult'.
      Open

              $labels = \App\Record::getLabel(array_keys($rows));
      Severity: Minor
      Found in app/RecordSearch.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 'getSearchableModules'.
      Open

                      $searchableModules[$moduleName] = \Vtiger_Module_Model::getInstance($moduleName);
      Severity: Minor
      Found in app/RecordSearch.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 'getSearchableModules'.
      Open

              $userId = $userId ?: \App\User::getCurrentUserId();
      Severity: Minor
      Found in app/RecordSearch.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 getSearchLabelQuery uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $where[] = ['like', 'csl.searchlabel', $this->searchValue];
                      }
      Severity: Minor
      Found in app/RecordSearch.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 '\vtlib\Functions' in method 'getSearchResult'.
      Open

                  $recordMeta = \vtlib\Functions::getCRMRecordMetadata($row['crmid']);
      Severity: Minor
      Found in app/RecordSearch.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 getQueryByModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $searchTableName = self::LABEL_TABLE_NAME;
                  $searchColumnName = "{$searchTableName}.label";
              }
      Severity: Minor
      Found in app/RecordSearch.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\Cache' in method 'getSearchableModules'.
      Open

              if (Cache::staticHas('getSearchableModules', $userId)) {
      Severity: Minor
      Found in app/RecordSearch.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 'getSearchResult'.
      Open

                  $row['permitted'] = \App\Privilege::isPermitted($row['setype'], 'DetailView', $row['crmid']);
      Severity: Minor
      Found in app/RecordSearch.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 getSearchLabelQuery uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $query->andWhere(new \yii\db\Expression('1=0'));
                      }
      Severity: Minor
      Found in app/RecordSearch.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 '\Users_Privileges_Model' in method 'getSearchableModules'.
      Open

              $userPrivModel = \Users_Privileges_Model::getInstanceById($userId);
      Severity: Minor
      Found in app/RecordSearch.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\Config' in method 'getSearchLabelQuery'.
      Open

              if (2 === \App\Config::search('GLOBAL_SEARCH_SORTING_RESULTS')) {
      Severity: Minor
      Found in app/RecordSearch.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

          public function parseWordForFullText(string $text): string
          {
              if (($word = preg_replace('/[><()~*"@+-]/', ' +', $text)) !== $text) {
                  $words = preg_split('/\s|\+/', $word, -1, PREG_SPLIT_NO_EMPTY);
                  $word = $words ? '+' . implode(' +', $words) : '';
      Severity: Minor
      Found in app/RecordSearch.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

              $this->userId = \App\User::getCurrentUserId();
      Severity: Minor
      Found in app/RecordSearch.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

          public function getSearchLabelQuery(): Db\Query
          {
              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
                  ->from('u_#__crmentity_search_label csl')
                  ->innerJoin('vtiger_tab', 'csl.tabid = vtiger_tab.tabid')
      Severity: Minor
      Found in app/RecordSearch.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

              } else {
                  $modules = array_keys($searchableModules);
              }
      Severity: Minor
      Found in app/RecordSearch.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\Cache' in method 'getSearchableModules'.
      Open

                  return Cache::staticGet('getSearchableModules', $userId);
      Severity: Minor
      Found in app/RecordSearch.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\Config' in method '__construct'.
      Open

                  $limit = \App\Config::search('GLOBAL_SEARCH_MODAL_MAX_NUMBER_RESULT', 20);
      Severity: Minor
      Found in app/RecordSearch.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 'getSearchResult'.
      Open

                  $recordInstance = \Vtiger_Record_Model::getCleanInstance($moduleName);
      Severity: Minor
      Found in app/RecordSearch.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\Cache' in method 'getSearchableModules'.
      Open

              Cache::staticSave('getSearchableModules', $userId, $searchableModules);
      Severity: Minor
      Found in app/RecordSearch.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 "vtiger_tab.name" 4 times.
      Open

              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
      Severity: Critical
      Found in app/RecordSearch.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 "FulltextBegin" 3 times.
      Open

              'PLL_FULLTEXT_BEGIN' => 'FulltextBegin',
      Severity: Critical
      Found in app/RecordSearch.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 "getSearchableModules" 3 times.
      Open

              if (Cache::staticHas('getSearchableModules', $userId)) {
      Severity: Critical
      Found in app/RecordSearch.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 "setype" 3 times.
      Open

              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
      Severity: Critical
      Found in app/RecordSearch.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 "Begin" 3 times.
      Open

              'PLL_STARTS_WITH' => 'Begin',
      Severity: Critical
      Found in app/RecordSearch.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 "csl.searchlabel" 5 times.
      Open

              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
      Severity: Critical
      Found in app/RecordSearch.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 "Contain" 3 times.
      Open

              'PLL_CONTAINS' => 'Contain',
      Severity: Critical
      Found in app/RecordSearch.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 ":findvalue" 3 times.
      Open

                          $query->andWhere('MATCH(csl.searchlabel) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $word . '*']);
      Severity: Critical
      Found in app/RecordSearch.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 "matcher" 8 times.
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(csl.searchlabel) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $word . '*'])]);
      Severity: Critical
      Found in app/RecordSearch.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 "cl.label" 4 times.
      Open

              $query = (new \App\Db\Query())->select(['cl.crmid', 'cl.label', 'vtiger_crmentity.setype'])
      Severity: Critical
      Found in app/RecordSearch.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

                  ->where(['vtiger_tab.presence' => 0])->indexBy('crmid');
      Severity: Critical
      Found in app/RecordSearch.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 "FulltextWord" 3 times.
      Open

              'PLL_FULLTEXT_WORD' => 'FulltextWord',
      Severity: Critical
      Found in app/RecordSearch.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.

      Move this "case default" clause to the end of this "switch" statement.
      Open

                  default:
      Severity: Critical
      Found in app/RecordSearch.php by sonar-php

      The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

      Noncompliant Code Example

      switch ($param) {  //missing default clause
        case 0:
          do_something();
          break;
        case 1:
          do_something_else();
          break;
      }
      
      switch ($param) {
        default: // default clause should be the last one
          error();
          break;
        case 0:
          do_something();
          break;
        case 1:
          do_something_else();
          break;
      }
      

      Compliant Solution

      switch ($param) {
        case 0:
          do_something();
          break;
        case 1:
          do_something_else();
          break;
        default:
          error();
          break;
      }
      

      See

      • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
      • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
      • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
      • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
      • MISRA C:2012, 16.1 - All switch statements shall be well-formed
      • MISRA C:2012, 16.4 - Every switch statement shall have a default label
      • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
      • MITRE, CWE-478 - Missing Default Case in Switch Statement
      • CERT, MSC01-C. - Strive for logical completeness
      • CERT, MSC01-CPP. - Strive for logical completeness

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(csl.searchlabel) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $word . '*'])]);
      Severity: Critical
      Found in app/RecordSearch.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.

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

                          $query->andWhere(new \yii\db\Expression('1=0'));
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

          public static function getQueryByModule(string $searchValue, string $moduleName, int $limit, int $userId = null): QueryGenerator
      Severity: Minor
      Found in app/RecordSearch.php by phan

      Return type of getSearchableModules() is undeclared type \App\Vtiger_Module_Model[]
      Open

          public static function getSearchableModules(int $userId = null): array
      Severity: Minor
      Found in app/RecordSearch.php by phan

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

           * @return Db\Query()|bool
      Severity: Info
      Found in app/RecordSearch.php by phan

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

              $query = (new \App\Db\Query())->select(['cl.crmid', 'cl.label', 'vtiger_crmentity.setype'])
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue . '*'])]);
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

              $userId = $userId ?: \App\User::getCurrentUserId();
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                          $conditions[] = new \yii\db\Expression("MATCH(csl.searchlabel) AGAINST(:findvalue{$key} IN BOOLEAN MODE)", [":findvalue{$key}" => $word]);
      Severity: Critical
      Found in app/RecordSearch.php by phan

      Doc-block of $limit in __construct is phpdoc param type int which is not a permitted replacement of the nullable param type ?int declared in the signature ('?T' should be documented as 'T|null' or '?T')
      Open

           * @param int   $limit
      Severity: Minor
      Found in app/RecordSearch.php by phan

      Call to method searchRecordCondition from undeclared class \App\Vtiger_Module_Model
      Open

                      $moduleModel->searchRecordCondition($query, $this);
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                  $query->limit($this->limit);
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

           * @return Db\Query()
      Severity: Info
      Found in app/RecordSearch.php by phan

      Doc-block of $limit in getSearchResult is phpdoc param type int which is not a permitted replacement of the nullable param type ?int declared in the signature ('?T' should be documented as 'T|null' or '?T')
      Open

           * @param int             $limit
      Severity: Minor
      Found in app/RecordSearch.php by phan

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

              return $query->all();
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

           * @return Db\Query()
      Severity: Info
      Found in app/RecordSearch.php by phan

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

              $queryGenerator->setFields(['id'])
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(csl.searchlabel) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $word . '*'])]);
      Severity: Critical
      Found in app/RecordSearch.php by phan

      Doc-block of $operator in getSearchResult is phpdoc param type string which is not a permitted replacement of the nullable param type ?string declared in the signature ('?T' should be documented as 'T|null' or '?T')
      Open

           * @param string          $operator
      Severity: Minor
      Found in app/RecordSearch.php by phan

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

              $dataReader = (new \App\Db\Query())->select(['vtiger_tab.name'])->from('vtiger_entityname')
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue])]);
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                  ->addJoin(['INNER JOIN', $searchTableName, "{$queryGenerator->getColumnName('id')} = {$searchTableName}.crmid"])
      Severity: Critical
      Found in app/RecordSearch.php by phan

      Doc-block of $userId in getQueryByModule is phpdoc param type int which is not a permitted replacement of the nullable param type ?int declared in the signature ('?T' should be documented as 'T|null' or '?T')
      Open

           * @param int    $userId
      Severity: Minor
      Found in app/RecordSearch.php by phan

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

              $this->userId = \App\User::getCurrentUserId();
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                      return false;
      Severity: Minor
      Found in app/RecordSearch.php by phan

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

              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

                      $query->addSelect(['matcher' => new \yii\db\Expression(implode('+', $matcher), $params)]);
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

              $queryGenerator = new \App\QueryGenerator($moduleName, $userId);
      Severity: Critical
      Found in app/RecordSearch.php by phan

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

              'PLL_FULLTEXT_WORD' => 'FulltextWord',
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              'PLL_FULLTEXT_BEGIN' => 'FulltextBegin',
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $moduleName;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $limit;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /** @var string Table name for search mechanisms */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /** @var string Table name for labels */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public const LABEL_MODE = 0;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              'PLL_CONTAINS' => 'Contain',
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Operators.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $searchValue;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public const LABEL_TABLE_NAME = 'u_#__crmentity_label';
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public const SEARCH_MODE = 1;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public const OPERATORS = [
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              'PLL_STARTS_WITH' => 'Begin',
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $userId;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public const SEARCH_TABLE_NAME = 'u_#__crmentity_search_label';
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /** @var int Search mode for labels */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /** @var int Search mode for search engines */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              'PLL_ENDS_WITH' => 'End',
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          ];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return array
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if ($this->limit) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->andWhere(['vtiger_tab.name' => $modules]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              } else {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $where[] = ['like', 'csl.searchlabel', "{$this->searchValue}%", false];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'End':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addOrderBy(['matcher' => SORT_DESC]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $this;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $query->all();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      return $this->getSearchLabelQuery();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->from('u_#__crmentity_search_label csl')
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $query->orderBy('vtiger_entityname.sequence');
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 170 characters
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(csl.searchlabel) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $word . '*'])]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $conditions[] = new \yii\db\Expression("MATCH(csl.searchlabel) AGAINST(:findvalue{$key} IN BOOLEAN MODE)", [":findvalue{$key}" => $word]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $this->userId = \App\User::getCurrentUserId();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case self::LABEL_MODE:
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      return false;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $query->andWhere('MATCH(csl.searchlabel) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $word . '*']);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $params[":searchValue{$key}"] = $word;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      if (false !== strpos($this->searchValue, '*') || false !== strpos($this->searchValue, '_')) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $where[] = ['like', 'csl.searchlabel', $this->searchValue];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $query->andWhere($where);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $this->searchValue = $searchValue;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return self
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $where = ['and'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      if (preg_match('/[><()~*"@+-]/', $this->searchValue)) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function getQuery()
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if ($this->moduleName) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              switch ($this->operator) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Construct.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param mixed $searchValue
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if (!$limit) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function search()
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $query->limit($this->limit);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  default:
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $modules = \is_array($this->moduleName) ? $this->moduleName : [$this->moduleName];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $where[] = ['like', 'csl.userid', ",{$this->userId},"];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $where[] = ['like', 'csl.searchlabel', "%{$this->searchValue}", false];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $entityName = true;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $matcher[] = "MATCH(csl.searchlabel) AGAINST(:searchValue{$key} IN BOOLEAN MODE)";
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $where[] = ['like', 'csl.searchlabel', str_replace('*', '%', "%{$this->searchValue}%"), false];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return Db\Query()|bool
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Parse text for Full-Text Search.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $query = (new Db\Query())->select(['csl.crmid', 'setype' => 'vtiger_tab.name', 'csl.searchlabel'])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->innerJoin('vtiger_entityname', 'vtiger_tab.tabid = vtiger_entityname.tabid')
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $searchableModules = self::getSearchableModules();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if (2 === \App\Config::search('GLOBAL_SEARCH_SORTING_RESULTS')) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          foreach ($words as $key => $word) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $table = self::SEARCH_MODE;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $checkPermissions = true;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $limit = \App\Config::search('GLOBAL_SEARCH_MODAL_MAX_NUMBER_RESULT', 20);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param int $mode
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Search record.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->where(['vtiger_tab.presence' => 0])->indexBy('crmid');
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if ($this->checkPermissions) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $words = preg_split('/\s/', $this->searchValue, -1, PREG_SPLIT_NO_EMPTY);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                              $words[$key] = $this->parseWordForFullText($word);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $matcher = $params = [];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addOrderBy(['matcher' => SORT_DESC]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param mixed $moduleName
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  if (method_exists($moduleModel, 'searchRecordCondition')) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'Begin':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $this->moduleName = $moduleName;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case self::SEARCH_MODE:
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      return $this->getLabelQuery();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  if (\count($modules) !== \count($searchableModules)) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $modules = array_keys($searchableModules);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      foreach ($words as $key => $word) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->andWhere($conditions);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      } else {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Get query.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return Db\Query()
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function getSearchLabelQuery(): Db\Query
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          $query->andWhere(new \yii\db\Expression('1=0'));
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Set search mode.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $this->table = $mode;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->innerJoin('vtiger_tab', 'csl.tabid = vtiger_tab.tabid')
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $modules = array_intersect($modules, array_keys($searchableModules));
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $this->limit = (int) $limit;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $moduleModel = $searchableModules[$moduleName];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function setMode(int $mode): self
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'FulltextBegin':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 130 characters
      Open

                          $query->andWhere('MATCH(csl.searchlabel) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $word . '*']);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Get search label query.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      } else {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  default:
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              foreach ($modules as $moduleName) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'FulltextWord':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $conditions = ['or'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addSelect(['matcher' => new \yii\db\Expression(implode('+', $matcher), $params)]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param string $text
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      if ($word = $this->parseWordForFullText($this->searchValue)) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $words = [$this->searchValue];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 158 characters
      Open

                          $conditions[] = new \yii\db\Expression("MATCH(csl.searchlabel) AGAINST(:findvalue{$key} IN BOOLEAN MODE)", [":findvalue{$key}" => $word]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public $operator = 'Contain';
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param int   $limit
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function __construct($searchValue, $moduleName = false, int $limit = null)
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $query = $this->getQuery();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              switch ($this->table) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $moduleModel->searchRecordCondition($query, $this);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(csl.searchlabel) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $word . '*'])]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'Contain':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 132 characters
      Open

                      $query->andWhere('MATCH(cl.label) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $this->searchValue . '*']);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if (isset(self::getSearchableModules()[$moduleName])) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $searchTableName = self::SEARCH_TABLE_NAME;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->setLimit($limit);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $words = preg_split('/\s|\+/', $word, -1, PREG_SPLIT_NO_EMPTY);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $where = ['and'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Get field model for search mechanism.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Function to get the list of records matching the search key.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $recordMeta = \vtlib\Functions::getCRMRecordMetadata($row['crmid']);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->setCustomColumn(['search_label' => $searchColumnName])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $userPrivModel = \Users_Privileges_Model::getInstanceById($userId);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->innerJoin('vtiger_tab', 'vtiger_tab.tabid=vtiger_entityname.tabid')
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              switch ($this->operator) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 126 characters
      Open

                      $query->andWhere('MATCH(cl.label) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $this->searchValue]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if ($this->checkPermissions) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param int             $limit
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $recordSearch->operator = $operator;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $row['id'] = $row['crmid'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if ($this->moduleName) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $where[] = ['like', 'vtiger_crmentity.users', ",$this->userId,"];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $labels = \App\Record::getLabel(array_keys($rows));
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $row['label'] = \App\Purifier::decodeHtml($labels[$row['crmid']]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $row['permitted'] = \App\Privilege::isPermitted($row['setype'], 'DetailView', $row['crmid']);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Mainly used in autocomplete mechanisms.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $searchableModules[$moduleName] = \Vtiger_Module_Model::getInstance($moduleName);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $word;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->from('u_#__crmentity_label cl')->innerJoin('vtiger_crmentity', 'cl.crmid = vtiger_crmentity.crmid');
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $where[] = ['vtiger_crmentity.setype' => $this->moduleName];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $where[] = ['like', 'cl.label', "{$this->searchValue}%", false];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $where[] = ['like', 'cl.label', $this->searchValue];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $row['createdtime'] = $recordMeta['createdtime'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $matchingRecords;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param string $searchValue
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if (($word = preg_replace('/[><()~*"@+-]/', ' +', $text)) !== $text) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $query = (new \App\Db\Query())->select(['cl.crmid', 'cl.label', 'vtiger_crmentity.setype'])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'FulltextBegin':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addOrderBy(['matcher' => SORT_DESC]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return (new \Vtiger_Field_Model())->set('name', 'search')->set('uitype', 1)->set('typeofdata', 'V~O')->set('maximumlength', 255);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param string|string[] $module
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $row['assigned_user_id'] = $recordMeta['smownerid'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * The function creates a query gets data from the module with user rights, taking into account special tables.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param int    $limit
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              } else {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return Vtiger_Module_Model[] List of Vtiger_Module_Model instances
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue . '*'])]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param int|null $userId
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $userId = $userId ?: \App\User::getCurrentUserId();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  return Cache::staticGet('getSearchableModules', $userId);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $dataReader = (new \App\Db\Query())->select(['vtiger_tab.name'])->from('vtiger_entityname')
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->where(['vtiger_tab.presence' => 0, 'turn_off' => 1])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->andWhere(['not', ['vtiger_tab.name' => 'Users']])->createCommand()->query();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $where[] = ['like', 'cl.label', "%{$this->searchValue}", false];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue])]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->andWhere('MATCH(cl.label) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $this->searchValue]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public static function getSearchResult($searchKey, $module = null, int $limit = null, string $operator = null): array
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $recordSearch = new self($searchKey, $module, $limit);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $queryGenerator = new \App\QueryGenerator($moduleName, $userId);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->addNativeCondition(['like', $searchColumnName, $searchValue])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $word = $words ? '+' . implode(' +', $words) : '';
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return Db\Query()
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'Begin':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param string          $searchKey
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $searchColumnName = "{$searchTableName}.searchlabel";
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Function to get the list of all searchable modules.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public static function getSearchableModules(int $userId = null): array
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return array
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $queryGenerator;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $searchableModules = [];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  default:
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $query->andWhere($where);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $rows = $recordSearch->search();
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  ->addJoin(['INNER JOIN', $searchTableName, "{$queryGenerator->getColumnName('id')} = {$searchTableName}.crmid"])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Get label query.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->addOrderBy(['matcher' => SORT_DESC]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 121 characters
      Open

          public static function getSearchResult($searchKey, $module = null, int $limit = null, string $operator = null): array
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $matchingRecords = [];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 132 characters
      Open

          public static function getQueryByModule(string $searchValue, string $moduleName, int $limit, int $userId = null): QueryGenerator
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  if ($userPrivModel->hasModuleActionPermission($moduleName, 'DetailView')) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return string
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function parseWordForFullText(string $text): string
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      $query->andWhere('MATCH(cl.label) AGAINST(:findvalue IN BOOLEAN MODE)', [':findvalue' => $this->searchValue . '*']);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 124 characters
      Open

                  ->addJoin(['INNER JOIN', $searchTableName, "{$queryGenerator->getColumnName('id')} = {$searchTableName}.crmid"])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if (Cache::staticHas('getSearchableModules', $userId)) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              return $searchableModules;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 176 characters
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue . '*'])]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           */
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 137 characters
      Open

              return (new \Vtiger_Field_Model())->set('name', 'search')->set('uitype', 1)->set('typeofdata', 'V~O')->set('maximumlength', 255);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              if ($operator) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $searchTableName = self::LABEL_TABLE_NAME;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              $queryGenerator->setFields(['id'])
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              while ($moduleName = $dataReader->readColumn(0)) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              Cache::staticSave('getSearchableModules', $userId, $searchableModules);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'End':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              }
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * Used in the global search engine.
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param string          $operator
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

              foreach ($rows as $row) {
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $recordInstance = \Vtiger_Record_Model::getCleanInstance($moduleName);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return QueryGenerator
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public static function getQueryByModule(string $searchValue, string $moduleName, int $limit, int $userId = null): QueryGenerator
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          /**
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public function getLabelQuery(): Db\Query
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                      break;
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  case 'FulltextWord':
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      Line exceeds 120 characters; contains 170 characters
      Open

                      $query->addSelect(['matcher' => new \yii\db\Expression('MATCH(cl.label) AGAINST(:searchValue IN BOOLEAN MODE)', [':searchValue' => $this->searchValue])]);
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @return \Vtiger_Field_Model
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

          public static function getSearchField(): \Vtiger_Field_Model
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $moduleName = $row['setype'];
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param string $moduleName
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           * @param int    $userId
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

           *
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

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

                  $searchColumnName = "{$searchTableName}.label";
      Severity: Minor
      Found in app/RecordSearch.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status