YetiForceCompany/YetiForceCRM

View on GitHub
app/Record.php

Summary

Maintainability
D
2 days
Test Coverage
C
73%

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

    public static function computeLabels($moduleName, $ids, $search = false): ?array
    {
        if (empty($moduleName) || empty($ids)) {
            return [];
        }
Severity: Minor
Found in app/Record.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

class Record
{
    /**
     * Get label.
     *
Severity: Minor
Found in app/Record.php by phpmd

File Record.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Record basic file.
 *
 * @package App
Severity: Minor
Found in app/Record.php - About 3 hrs to fix

    Method computeLabels has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function computeLabels($moduleName, $ids, $search = false): ?array
        {
            if (empty($moduleName) || empty($ids)) {
                return [];
            }
    Severity: Major
    Found in app/Record.php - About 2 hrs to fix

      Function updateLabelOnSave has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function updateLabelOnSave(\Vtiger_Record_Model $recordModel): void
          {
              $label = '';
              $metaInfo = \App\Module::getEntityInfo($recordModel->getModuleName());
              $dbCommand = Db::getInstance()->createCommand();
      Severity: Minor
      Found in app/Record.php - About 2 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 updateLabelOnSave has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function updateLabelOnSave(\Vtiger_Record_Model $recordModel): void
          {
              $label = '';
              $metaInfo = \App\Module::getEntityInfo($recordModel->getModuleName());
              $dbCommand = Db::getInstance()->createCommand();
      Severity: Minor
      Found in app/Record.php - About 1 hr to fix

        Function updateLabel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function updateLabel(string $moduleName, int $id): void
            {
                $dbCommand = \App\Db::getInstance()->createCommand();
                $labelTableName = \App\RecordSearch::LABEL_TABLE_NAME;
                $searchTableName = \App\RecordSearch::SEARCH_TABLE_NAME;
        Severity: Minor
        Found in app/Record.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function getLabel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getLabel($mixedId, bool $raw = false)
            {
                $multiMode = \is_array($mixedId);
                $ids = array_filter($multiMode ? array_unique($mixedId) : [$mixedId]);
                $result = $missing = [];
        Severity: Minor
        Found in app/Record.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

        Method getLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getLabel($mixedId, bool $raw = false)
            {
                $multiMode = \is_array($mixedId);
                $ids = array_filter($multiMode ? array_unique($mixedId) : [$mixedId]);
                $result = $missing = [];
        Severity: Minor
        Found in app/Record.php - About 1 hr to fix

          Method getHtmlLink has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
              {
                  $state = self::getState($id);
                  if (null === $state) {
                      return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
          Severity: Minor
          Found in app/Record.php - About 1 hr to fix

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

                public static function getParentRecord($recordId, $moduleName = false): ?int
                {
                    if (Cache::has(__METHOD__, $recordId)) {
                        return Cache::get(__METHOD__, $recordId);
                    }
            Severity: Minor
            Found in app/Record.php - About 45 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
                {
                    $state = self::getState($id);
                    if (null === $state) {
                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.php - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            The method getHtmlLink() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
            Open

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
                {
                    $state = self::getState($id);
                    if (null === $state) {
                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.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 computeLabels() has an NPath complexity of 1872. The configured NPath complexity threshold is 200.
            Open

                public static function computeLabels($moduleName, $ids, $search = false): ?array
                {
                    if (empty($moduleName) || empty($ids)) {
                        return [];
                    }
            Severity: Minor
            Found in app/Record.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 getLabel() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
            Open

                public static function getLabel($mixedId, bool $raw = false)
                {
                    $multiMode = \is_array($mixedId);
                    $ids = array_filter($multiMode ? array_unique($mixedId) : [$mixedId]);
                    $result = $missing = [];
            Severity: Minor
            Found in app/Record.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function computeLabels($moduleName, $ids, $search = false): ?array
                {
                    if (empty($moduleName) || empty($ids)) {
                        return [];
                    }
            Severity: Minor
            Found in app/Record.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
                {
                    $state = self::getState($id);
                    if (null === $state) {
                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function updateLabelOnSave(\Vtiger_Record_Model $recordModel): void
                {
                    $label = '';
                    $metaInfo = \App\Module::getEntityInfo($recordModel->getModuleName());
                    $dbCommand = Db::getInstance()->createCommand();
            Severity: Minor
            Found in app/Record.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

            Reduce the number of returns of this function 4, down to the maximum allowed 3.
            Open

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
            Severity: Major
            Found in app/Record.php by sonar-php

            Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

            Noncompliant Code Example

            With the default threshold of 3:

            function myFunction(){ // Noncompliant as there are 4 return statements
              if (condition1) {
                return true;
              } else {
                if (condition2) {
                  return false;
                } else {
                  return true;
                }
              }
              return false;
            }
            

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

                public static function updateLabelOnSave(\Vtiger_Record_Model $recordModel): void
            Severity: Critical
            Found in app/Record.php by sonar-php

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

            See

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

                public static function computeLabels($moduleName, $ids, $search = false): ?array
            Severity: Critical
            Found in app/Record.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 Record has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
            Open

            class Record
            {
                /**
                 * Get label.
                 *
            Severity: Minor
            Found in app/Record.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 '43', column '18').
            Open

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Minor
            Found in app/Record.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 computeLabels has a boolean flag argument $search, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function computeLabels($moduleName, $ids, $search = false): ?array
            Severity: Minor
            Found in app/Record.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 '124', column '17').
            Open

                        $query = new \App\Db\Query();
            Severity: Minor
            Found in app/Record.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 getCrmIdByLabel has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getCrmIdByLabel($moduleName, $label, $userId = false)
            Severity: Minor
            Found in app/Record.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

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

                public static function getLabel($mixedId, bool $raw = false)
            Severity: Minor
            Found in app/Record.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 '78', column '17').
            Open

                    $query = (new \App\Db\Query())
            Severity: Minor
            Found in app/Record.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 '194', column '13').
            Open

                        if ((new \App\Db\Query())->from($labelTableName)->where(['crmid' => $id])->exists()) {
            Severity: Minor
            Found in app/Record.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 isExists has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function isExists($recordId, $moduleName = false)
            Severity: Minor
            Found in app/Record.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 '347', column '23').
            Open

                                $parentId = (new \App\Db\Query())->select(["{$field['tablename']}.{$field['columnname']}"])
            Severity: Minor
            Found in app/Record.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 '201', column '14').
            Open

                            if ((new \App\Db\Query())->from($searchTableName)->where(['crmid' => $id])->exists()) {
            Severity: Minor
            Found in app/Record.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 '375', column '14').
            Open

                    $id = (new \App\Db\Query())->select(['vtiger_crmentity.crmid'])
            Severity: Minor
            Found in app/Record.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 getParentRecord has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getParentRecord($recordId, $moduleName = false): ?int
            Severity: Minor
            Found in app/Record.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

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

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
            Severity: Minor
            Found in app/Record.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

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

                        } else {
                            $result[$id] = Cache::get('recordLabel', $id);
                        }
            Severity: Minor
            Found in app/Record.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 'getLabel'.
            Open

                            $result[$id] = Cache::get('recordLabel', $id);
            Severity: Minor
            Found in app/Record.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\RecordSearch' in method 'updateLabel'.
            Open

            }
            Severity: Minor
            Found in app/Record.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 'getLabel'.
            Open

                        if (!Cache::has('recordLabel', $id)) {
            Severity: Minor
            Found in app/Record.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 'getCrmIdByLabel'.
            Open

                    if (\App\Cache::staticHas(__METHOD__, $key)) {
            Severity: Minor
            Found in app/Record.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\Utils\Completions' in method 'getLabel'.
            Open

                            $label = \App\Utils\Completions::decodeEmoji($row['label']);
            Severity: Minor
            Found in app/Record.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 'getLabel'.
            Open

                            Cache::save('recordLabel', $row['crmid'], $label);
            Severity: Minor
            Found in app/Record.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 computeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $query = \App\Cache::staticGet($cacheName, $moduleName);
                        $columnsName = $metaInfo['fieldnameArr'];
                        $columnsSearch = $metaInfo['searchcolumnArr'];
                        $idColumn = $metaInfo['entityidfield'];
            Severity: Minor
            Found in app/Record.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\TextUtils' in method 'computeLabels'.
            Open

                            $searchLabel = TextUtils::textTruncate(trim(implode($separator, $labelName)), 250, false);
            Severity: Minor
            Found in app/Record.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 'getLabel'.
            Open

                            Cache::save('recordLabel', $id, $computeLabel);
            Severity: Minor
            Found in app/Record.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\Module' in method 'computeLabels'.
            Open

                    $metaInfo = \App\Module::getEntityInfo($moduleName);
            Severity: Minor
            Found in app/Record.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 'computeLabels'.
            Open

                        $query = \App\Cache::staticGet($cacheName, $moduleName);
            Severity: Minor
            Found in app/Record.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 'computeLabels'.
            Open

                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.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\RecordSearch' in method 'updateLabelOnSave'.
            Open

            }
            Severity: Minor
            Found in app/Record.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 'computeLabels'.
            Open

                        \App\Cache::staticSave($cacheName, $moduleName, clone $query);
            Severity: Minor
            Found in app/Record.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\TextUtils' in method 'computeLabels'.
            Open

                        $label = TextUtils::textTruncate(trim(implode($separator, $labelName)), 250, false);
            Severity: Minor
            Found in app/Record.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 computeLabels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $entityDisplay[$recordId] = $label;
                        }
            Severity: Minor
            Found in app/Record.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 'computeLabels'.
            Open

                    if (!\App\Cache::staticHas($cacheName, $moduleName)) {
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Field' in method 'computeLabels'.
            Open

                        $moduleInfoExtend = \App\Field::getModuleFieldInfos($moduleName, true);
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            $metaInfo = Functions::getCRMRecordMetadata($id);
            Severity: Minor
            Found in app/Record.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 'getCrmIdByLabel'.
            Open

                        return \App\Cache::staticGet(__METHOD__, $key);
            Severity: Minor
            Found in app/Record.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 updateLabel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $dbCommand->insert($labelTableName, ['crmid' => $id, 'label' => $label])->execute();
                        }
            Severity: Minor
            Found in app/Record.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 '\CRMEntity' in method 'getParentRecord'.
            Open

                                $entity = \CRMEntity::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.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 'getCrmIdByLabel'.
            Open

                    \App\Cache::staticSave(__METHOD__, $key, $crmId);
            Severity: Minor
            Found in app/Record.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 updateLabel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $label = $metaInfo[$id]['name'];
                        if ((new \App\Db\Query())->from($labelTableName)->where(['crmid' => $id])->exists()) {
                            $dbCommand->update($labelTableName, ['label' => $label], ['crmid' => $id])->execute();
                        } else {
            Severity: Minor
            Found in app/Record.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

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

                        } else {
                            $dbCommand->update('u_#__crmentity_label', ['label' => $label], ['crmid' => $recordModel->getId()])->execute();
                        }
            Severity: Minor
            Found in app/Record.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\TextUtils' in method 'updateLabelOnSave'.
            Open

                            $search = TextUtils::textTruncate(trim(implode($separator, $labelSearch)), 250, false) ?: '';
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    $recordMetaData = Functions::getCRMRecordMetadata($recordId);
            Severity: Minor
            Found in app/Record.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_Inventory_Model' in method 'getCurrencyIdFromInventory'.
            Open

                    $invData = \Vtiger_Inventory_Model::getInventoryDataById($recordId, $moduleName);
            Severity: Minor
            Found in app/Record.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 'getParentRecord'.
            Open

                        return Cache::get(__METHOD__, $recordId);
            Severity: Minor
            Found in app/Record.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 'getIdByRecordNumber'.
            Open

                    if (Cache::staticHas(__METHOD__, $recordNumber)) {
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'App\Fields\Currency' in method 'getCurrencyIdFromInventory'.
            Open

            }
            Severity: Minor
            Found in app/Record.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 'updateLabelOnSave'.
            Open

                    Cache::save('recordLabel', $recordModel->getId(), $label);
            Severity: Minor
            Found in app/Record.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\Language' in method 'getHtmlLink'.
            Open

                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.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 updateLabelOnSave uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                            } else {
                                $dbCommand->update('u_#__crmentity_search_label', ['searchlabel' => $search], ['crmid' => $recordModel->getId()])->execute();
                            }
            Severity: Minor
            Found in app/Record.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\Language' in method 'getHtmlLink'.
            Open

                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.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\TextUtils' in method 'updateLabelOnSave'.
            Open

                        $label = TextUtils::textTruncate(trim(implode($separator, $labelName)), 250, false) ?: '';
            Severity: Minor
            Found in app/Record.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 '342', column '7').
            Open

                public static function getParentRecord($recordId, $moduleName = false): ?int
                {
                    if (Cache::has(__METHOD__, $recordId)) {
                        return Cache::get(__METHOD__, $recordId);
                    }
            Severity: Minor
            Found in app/Record.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\Cache' in method 'getIdByRecordNumber'.
            Open

                        return Cache::staticGet(__METHOD__, $recordNumber);
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    $recordModel->label = \App\Purifier::encodeHtml($label);
            Severity: Minor
            Found in app/Record.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\ModuleHierarchy' in method 'getParentRecord'.
            Open

                    if ($parentModules = ModuleHierarchy::getModulesMap1M($moduleName)) {
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'App\Fields\RecordNumber' in method 'getIdByRecordNumber'.
            Open

                    $field = Fields\RecordNumber::getSequenceNumberField(Module::getModuleId($moduleName));
            Severity: Minor
            Found in app/Record.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 'getHtmlLink'.
            Open

                    if ($id && !Privilege::isPermitted($moduleName, 'DetailView', $id)) {
            Severity: Minor
            Found in app/Record.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 updateLabel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                            } else {
                                $dbCommand->insert($searchTableName, ['crmid' => $id, 'searchlabel' => $label, 'tabid' => \App\Module::getModuleId($moduleName)])->execute();
                            }
            Severity: Minor
            Found in app/Record.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 'getType'.
            Open

                    $metadata = Functions::getCRMRecordMetadata($recordId);
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\CRMEntity' in method 'getIdByRecordNumber'.
            Open

                    $entity = \CRMEntity::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.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\TextUtils' in method 'getHtmlLink'.
            Open

                        $label = TextUtils::textTruncate($label, $length);
            Severity: Minor
            Found in app/Record.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 'getParentRecord'.
            Open

                    Cache::save(__METHOD__, $recordId, $parentId);
            Severity: Minor
            Found in app/Record.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 'getHtmlLink'.
            Open

                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    $metadata = Functions::getCRMRecordMetadata($recordId);
            Severity: Minor
            Found in app/Record.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'App\Field' in method 'getParentRecord'.
            Open

                            if ($field = Field::getRelatedFieldForModule($moduleName, $parentModule)) {
            Severity: Minor
            Found in app/Record.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\Module' in method 'getIdByRecordNumber'.
            Open

                    $field = Fields\RecordNumber::getSequenceNumberField(Module::getModuleId($moduleName));
            Severity: Minor
            Found in app/Record.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 'getParentRecord'.
            Open

                    if (Cache::has(__METHOD__, $recordId)) {
            Severity: Minor
            Found in app/Record.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 'getIdByRecordNumber'.
            Open

                    Cache::staticSave(__METHOD__, $recordNumber, $id);
            Severity: Minor
            Found in app/Record.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\Module' in method 'updateLabel'.
            Open

                                $dbCommand->insert($searchTableName, ['crmid' => $id, 'searchlabel' => $label, 'tabid' => \App\Module::getModuleId($moduleName)])->execute();
            Severity: Minor
            Found in app/Record.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 updateLabelOnSave uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $separator = $metaInfo['separator'] ?? ' ';
                        $labelName = [];
                        foreach ($metaInfo['fieldnameArr'] as $columnName) {
                            $fieldModel = $recordModel->getModule()->getFieldByColumn($columnName);
            Severity: Minor
            Found in app/Record.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 'updateLabel'.
            Open

                        Cache::save('recordLabel', $id, $metaInfo[$id]['name']);
            Severity: Minor
            Found in app/Record.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\Module' in method 'updateLabelOnSave'.
            Open

                    $metaInfo = \App\Module::getEntityInfo($recordModel->getModuleName());
            Severity: Minor
            Found in app/Record.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 '344', column '9').
            Open

                public static function getParentRecord($recordId, $moduleName = false): ?int
                {
                    if (Cache::has(__METHOD__, $recordId)) {
                        return Cache::get(__METHOD__, $recordId);
                    }
            Severity: Minor
            Found in app/Record.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

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

                        ->innerJoin('vtiger_crmentity', 'cl.crmid = vtiger_crmentity.crmid')
            Severity: Critical
            Found in app/Record.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 "searchcolumnArr" 5 times.
            Open

                    if (!$metaInfo || (empty($metaInfo['fieldnameArr']) && empty($metaInfo['searchcolumnArr']))) {
            Severity: Critical
            Found in app/Record.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 "searchlabel" 4 times.
            Open

                                $dbCommand->update($searchTableName, ['searchlabel' => $label], ['crmid' => $id])->execute();
            Severity: Critical
            Found in app/Record.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 "recordLabel" 6 times.
            Open

                        if (!Cache::has('recordLabel', $id)) {
            Severity: Critical
            Found in app/Record.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

                            $computeLabel = static::computeLabels($metaInfo['setype'] ?? '', $id)[$id] ?? '';
            Severity: Critical
            Found in app/Record.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 "u_#__crmentity_search_label" 3 times.
            Open

                        $dbCommand->delete('u_#__crmentity_search_label', ['crmid' => $recordModel->getId()])->execute();
            Severity: Critical
            Found in app/Record.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 "u_#__crmentity_label" 4 times.
            Open

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Critical
            Found in app/Record.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" 18 times.
            Open

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Critical
            Found in app/Record.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

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

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Critical
            Found in app/Record.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 "tablename" 11 times.
            Open

                        $table = $metaInfo['tablename'];
            Severity: Critical
            Found in app/Record.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 "fieldnameArr" 5 times.
            Open

                    if (!$metaInfo || (empty($metaInfo['fieldnameArr']) && empty($metaInfo['searchcolumnArr']))) {
            Severity: Critical
            Found in app/Record.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 undeclared method \App\Db::createCommand
            Open

                    $dbCommand = \App\Db::getInstance()->createCommand();
            Severity: Critical
            Found in app/Record.php by phan

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

                            if ((new \App\Db\Query())->from($searchTableName)->where(['crmid' => $id])->exists()) {
            Severity: Critical
            Found in app/Record.php by phan

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

                    $id = (new \App\Db\Query())->select(['vtiger_crmentity.crmid'])
            Severity: Critical
            Found in app/Record.php by phan

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

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Critical
            Found in app/Record.php by phan

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

                    while ($row = $dataReader->read()) {
            Severity: Critical
            Found in app/Record.php by phan

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

                    $dbCommand = Db::getInstance()->createCommand();
            Severity: Critical
            Found in app/Record.php by phan

            Argument 2 (key) is int but \App\Cache::save() takes string defined at /code/app/Cache.php:89
            Open

                    Cache::save('recordLabel', $recordModel->getId(), $label);
            Severity: Minor
            Found in app/Record.php by phan

            Argument 1 (moduleName) is ?string|?true but \App\Field::getRelatedFieldForModule() takes bool|false|string defined at /code/app/Field.php:232
            Open

                            if ($field = Field::getRelatedFieldForModule($moduleName, $parentModule)) {
            Severity: Minor
            Found in app/Record.php by phan

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

                                    $query->leftJoin($otherTable, "$table.$focusTables[$table] = $otherTable.$focusTables[$otherTable]");
            Severity: Critical
            Found in app/Record.php by phan

            Argument 1 (moduleName) is ?string but \App\Privilege::isPermitted() takes string defined at /code/app/Privilege.php:48
            Open

                    if ($id && !Privilege::isPermitted($moduleName, 'DetailView', $id)) {
            Severity: Minor
            Found in app/Record.php by phan

            Call to method decodeEmoji from undeclared class \App\Utils\Completions
            Open

                            $label = \App\Utils\Completions::decodeEmoji($row['label']);
            Severity: Critical
            Found in app/Record.php by phan

            Argument 2 (key) is int but \App\Cache::has() takes string defined at /code/app/Cache.php:74
            Open

                    if (Cache::has(__METHOD__, $recordId)) {
            Severity: Minor
            Found in app/Record.php by phan

            Argument 2 (key) is int but \App\Cache::save() takes string defined at /code/app/Cache.php:89
            Open

                    Cache::save(__METHOD__, $recordId, $parentId);
            Severity: Minor
            Found in app/Record.php by phan

            Argument 1 (mixed) is ?string but \Vtiger_Module_Model::getInstance() takes int|string defined at /code/modules/Vtiger/models/Module.php:197
            Open

                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phan

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

                                $parentId = (new \App\Db\Query())->select(["{$field['tablename']}.{$field['columnname']}"])
            Severity: Critical
            Found in app/Record.php by phan

            When fetching an array index from a value of type string, found an array index of type 'name', but expected the index to be of type int
            Open

                        $label = $metaInfo[$id]['name'];
            Severity: Minor
            Found in app/Record.php by phan

            Default value for int $userId can't be false
            Open

                public static function getCrmIdByLabel($moduleName, $label, $userId = false)
            Severity: Minor
            Found in app/Record.php by phan

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

                    $query->where([$idColumn => $ids]);
            Severity: Critical
            Found in app/Record.php by phan

            Argument 2 (key) is int but \App\Cache::save() takes string defined at /code/app/Cache.php:89
            Open

                        Cache::save('recordLabel', $id, $metaInfo[$id]['name']);
            Severity: Minor
            Found in app/Record.php by phan

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

                        $query->select($paramsCol)->from($table);
            Severity: Critical
            Found in app/Record.php by phan

            Argument 1 (module) is ?string|?true but \CRMEntity::getInstance() takes string defined at /code/include/CRMEntity.php:61
            Open

                                $entity = \CRMEntity::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phan

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

                        if ((new \App\Db\Query())->from($labelTableName)->where(['crmid' => $id])->exists()) {
            Severity: Critical
            Found in app/Record.php by phan

            Returning type ?'Active'|?'Archived'|?'Trash' but getState() is declared to return string
            Open

                    return $state;
            Severity: Minor
            Found in app/Record.php by phan

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

                    $field = Fields\RecordNumber::getSequenceNumberField(Module::getModuleId($moduleName));
            Severity: Critical
            Found in app/Record.php by phan

            Reference to static property site_URL from undeclared class \Config\Main
            Open

                        $url = \Config\Main::$site_URL . $url;
            Severity: Critical
            Found in app/Record.php by phan

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

                    $query = (new \App\Db\Query())
            Severity: Critical
            Found in app/Record.php by phan

            When fetching an array index from a value of type string, found an array index of type 'search', but expected the index to be of type int
            Open

                            $label = $metaInfo[$id]['search'];
            Severity: Minor
            Found in app/Record.php by phan

            When fetching an array index from a value of type string, found an array index of type 'name', but expected the index to be of type int
            Open

                        Cache::save('recordLabel', $id, $metaInfo[$id]['name']);
            Severity: Minor
            Found in app/Record.php by phan

            Argument 2 (key) is int but \App\Cache::get() takes string defined at /code/app/Cache.php:61
            Open

                        return Cache::get(__METHOD__, $recordId);
            Severity: Minor
            Found in app/Record.php by phan

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

                public static function isExists($recordId, $moduleName = false)
            Severity: Minor
            Found in app/Record.php by phan

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

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
            Severity: Minor
            Found in app/Record.php by phpmd

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

                public static function updateLabel(string $moduleName, int $id): void
            Severity: Minor
            Found in app/Record.php by phpmd

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

                    $id = (new \App\Db\Query())->select(['vtiger_crmentity.crmid'])
            Severity: Minor
            Found in app/Record.php by phpmd

            ShortVariable

            Since: 0.2

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

            Example

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

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

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

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

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

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

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

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

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

                    $multiMode = \is_array($mixedId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                 * @param bool  $raw
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                 * @return mixed
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $ids = array_filter($multiMode ? array_unique($mixedId) : [$mixedId]);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                public static function getLabel($mixedId, bool $raw = false)
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    $result = $missing = [];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (!empty($missing)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $dataReader = $query->createCommand()->query();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $result[$id] = $computeLabel;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->select(['cl.crmid'])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $otherTable = $moduleInfoExtend[$column]['tablename'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        foreach ($columnsName as $columnName) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $entityDisplay[$recordId] = ['name' => $label, 'search' => $searchLabel];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        while ($row = $dataReader->read()) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                public static function getCrmIdByLabel($moduleName, $label, $userId = false)
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Function gets labels for record data.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                        return \App\Cache::staticGet(__METHOD__, $key);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->from('u_#__crmentity_label cl')
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->innerJoin('vtiger_crmentity', 'cl.crmid = vtiger_crmentity.crmid')
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @param bool      $search
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $metaInfo = \App\Module::getEntityInfo($moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (!\App\Cache::staticHas($cacheName, $moduleName)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        $paramsCol['id'] = $idColumn;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $dbCommand = \App\Db::getInstance()->createCommand();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $computeLabel = static::computeLabels($metaInfo['setype'] ?? '', $id)[$id] ?? '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $columnsName = $metaInfo['fieldnameArr'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        \App\Cache::staticSave($cacheName, $moduleName, clone $query);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    return $entityDisplay;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @return int
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        return null;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $table = $metaInfo['tablename'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $query = new \App\Db\Query();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $query = \App\Cache::staticGet($cacheName, $moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                                $fieldModel = $moduleModel->getFieldByColumn($columnName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                 * @return void
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->andWhere(['cl.label' => $label]);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @return string[]|null
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $cacheName = 'computeLabelsQuery';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $idColumn = $metaInfo['entityidfield'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $separator = $metaInfo['separator'] ?? ' ';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $result[$id] = Cache::get('recordLabel', $id);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

                        $moduleInfoExtend = \App\Field::getModuleFieldInfos($moduleName, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        foreach (array_filter($columns) as $column) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $missing[$id] = $id;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 131 characters
            Open

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

                        $leftJoinTables = $paramsCol = [];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            if (\array_key_exists($column, $moduleInfoExtend)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    $leftJoinTables[] = $otherTable;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $query->select($paramsCol)->from($table);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $searchLabel = TextUtils::textTruncate(trim(implode($separator, $labelName)), 250, false);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                        $query = (new \App\Db\Query())->select(['crmid', 'label'])->from('u_#__crmentity_label')->where(['crmid' => $missing]);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $metaInfo = Functions::getCRMRecordMetadata($id);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (!$raw && $result) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    if (\App\Cache::staticHas(__METHOD__, $key)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->where(['vtiger_crmentity.setype' => $moduleName])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                if ($otherTable !== $table && !\in_array($otherTable, $leftJoinTables)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 125 characters
            Open

                                    $query->leftJoin($otherTable, "$table.$focusTables[$table] = $otherTable.$focusTables[$otherTable]");
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $ids = array_unique($ids);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                        $idColumn = $table . '.' . $metaInfo['entityidfield'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $columnsSearch = $metaInfo['searchcolumnArr'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $columnsName = $metaInfo['fieldnameArr'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $columnsSearch = $metaInfo['searchcolumnArr'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $labelName[] = $fieldModel ? $fieldModel->getDisplayValue($row[$columnName], $recordId, false, true) : '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            Cache::save('recordLabel', $row['crmid'], $label);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        foreach (array_diff_key($missing, $result) as $id) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Function searches for record ID with given label.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $key = $moduleName . $label . '_' . $userId;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    return $crmId;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                 * @param array|int $ids
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    $query->leftJoin($otherTable, "$table.$focusTables[$table] = $otherTable.$focusTables[$otherTable]");
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    while ($row = $dataReader->read()) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

                        $query->andWhere(['like', 'vtiger_crmentity.users', ",$userId,"]);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    if (!$metaInfo || (empty($metaInfo['fieldnameArr']) && empty($metaInfo['searchcolumnArr']))) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            foreach ($columnsSearch as $columnName) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $result = array_map('\App\Purifier::encodeHtml', $result);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $query = (new \App\Db\Query())
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    \App\Cache::staticSave(__METHOD__, $key, $crmId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (empty($moduleName) || empty($ids)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        return [];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (!\is_array($ids)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $focus = $moduleModel->getEntityInstance();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $dataReader = $query->createCommand()->query();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $fieldModel = $moduleModel->getFieldByColumn($columnName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        $label = TextUtils::textTruncate(trim(implode($separator, $labelName)), 250, false);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $entityDisplay[$recordId] = $label;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Update record label.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            $result[$row['crmid']] = $label;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

            Line exceeds 120 characters; contains 122 characters
            Open

                            $labelName[] = $fieldModel ? $fieldModel->getDisplayValue($row[$columnName], $recordId, false, true) : '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $labelName[] = $fieldModel ? $fieldModel->getDisplayValue($row[$columnName], $recordId, false, true) : '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                public static function updateLabel(string $moduleName, int $id): void
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    $crmId = $query->scalar();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $columns = array_unique(array_merge($columnsName, $columnsSearch));
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $paramsCol[] = $otherTable . '.' . $column;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    $focusTables = $focus->tab_name_index;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 126 characters
            Open

                                $labelName[] = $fieldModel ? $fieldModel->getDisplayValue($row[$columnName], $recordId, false, true) : '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    foreach ($ids as $id) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        if (!Cache::has('recordLabel', $id)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $label = \App\Utils\Completions::decodeEmoji($row['label']);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            Cache::save('recordLabel', $id, $computeLabel);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    return $multiMode ? $result : reset($result);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                public static function computeLabels($moduleName, $ids, $search = false): ?array
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $query->where([$idColumn => $ids]);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                    $metaInfo = static::computeLabels($moduleName, $id, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $label = '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                public static function getParentRecord($recordId, $moduleName = false): ?int
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

            Line exceeds 120 characters; contains 127 characters
            Open

                            $dbCommand->update('u_#__crmentity_label', ['label' => $label], ['crmid' => $recordModel->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    Cache::save('recordLabel', $recordModel->getId(), $label);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                public static function getState($recordId)
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $dbCommand->insert($labelTableName, ['crmid' => $id, 'label' => $label])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        foreach ($metaInfo['fieldnameArr'] as $columnName) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                                $fieldModel = $recordModel->getModule()->getFieldByColumn($columnName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $labelSearch[] = $fieldModel->getDisplayValue($recordModel->get($fieldModel->getName()), $recordModel->getId(), $recordModel, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    return $metadata ? $metadata['setype'] : null;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Get the currency ID for the inventory record.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

            Line exceeds 120 characters; contains 146 characters
            Open

                            $labelName[] = $fieldModel->getDisplayValue($recordModel->get($fieldModel->getName()), $recordModel->getId(), $recordModel, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        if ($recordModel->isNew()) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                public static function getType($recordId)
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $metadata = Functions::getCRMRecordMetadata($recordId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                 * @return int|null
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                 * Update record label on save.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $fieldModel = $recordModel->getModule()->getFieldByColumn($columnName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $search = TextUtils::textTruncate(trim(implode($separator, $labelSearch)), 250, false) ?: '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                            $state = 'Trash';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            if ((new \App\Db\Query())->from($searchTableName)->where(['crmid' => $id])->exists()) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $dbCommand->insert($searchTableName, ['crmid' => $id, 'searchlabel' => $label, 'tabid' => \App\Module::getModuleId($moduleName)])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        $dbCommand->delete('u_#__crmentity_search_label', ['crmid' => $recordModel->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            $dbCommand->update('u_#__crmentity_label', ['label' => $label], ['crmid' => $recordModel->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (!$metaInfo || (empty($metaInfo['fieldnameArr']) && empty($metaInfo['searchcolumnArr']))) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        $dbCommand->delete('u_#__crmentity_label', ['crmid' => $recordModel->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        if (isset(\App\RecordSearch::getSearchableModules()[$recordModel->getModuleName()])) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 145 characters
            Open

                                $dbCommand->update('u_#__crmentity_search_label', ['searchlabel' => $search], ['crmid' => $recordModel->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 152 characters
            Open

                                $labelSearch[] = $fieldModel->getDisplayValue($recordModel->get($fieldModel->getName()), $recordModel->getId(), $recordModel, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                    return current($invData)['currency'] ?? Fields\Currency::getDefault()['id'] ?? null;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $state = 'Archived';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $dbCommand->delete($searchTableName, ['crmid' => $id])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $dbCommand->update($searchTableName, ['searchlabel' => $label], ['crmid' => $id])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    $recordMetaData = Functions::getCRMRecordMetadata($recordId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                 * @return int|null
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $parentId = null;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    ->innerJoin('vtiger_crmentity', "{$field['tablename']}.{$index} = vtiger_crmentity.crmid")
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    $field = Fields\RecordNumber::getSequenceNumberField(Module::getModuleId($moduleName));
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $id = (new \App\Db\Query())->select(['vtiger_crmentity.crmid'])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->innerJoin('vtiger_crmentity', "{$field['tablename']}.{$index} = vtiger_crmentity.crmid")
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                 * @param bool        $fullUrl
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $label = TextUtils::textTruncate($label, $length);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

            Line exceeds 120 characters; contains 161 characters
            Open

                                $dbCommand->insert($searchTableName, ['crmid' => $id, 'searchlabel' => $label, 'tabid' => \App\Module::getModuleId($moduleName)])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        Cache::save('recordLabel', $id, $metaInfo[$id]['name']);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @param \Vtiger_Record_Model $recordModel
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $dbCommand = Db::getInstance()->createCommand();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $dbCommand->update('u_#__crmentity_search_label', ['searchlabel' => $search], ['crmid' => $recordModel->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                public static function getCurrencyIdFromInventory(int $recordId, string $moduleName): ?int
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        case 0:
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                 * Get record link and label.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        return $deleted ? "<s>{$label}</s>" : $label;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $url = \Config\Main::$site_URL . $url;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

            Line exceeds 120 characters; contains 190 characters
            Open

                                $dbCommand->insert('u_#__crmentity_search_label', ['crmid' => $recordModel->getId(), 'searchlabel' => $search, 'tabid' => $recordModel->getModule()->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Function checks if record exists.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @return bool
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                public static function isExists($recordId, $moduleName = false)
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    return (isset($recordMetaData) && 1 !== $recordMetaData['deleted'] && ($moduleName ? $recordMetaData['setype'] === $moduleName : true)) ? true : false;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @return string|null
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $metadata = Functions::getCRMRecordMetadata($recordId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        case 1:
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $state = null;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    Cache::save(__METHOD__, $recordId, $parentId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Get record id by record number .
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

            Line exceeds 120 characters; contains 127 characters
            Open

                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $moduleName = self::getType($id);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    return $deleted ? "<s>{$label}</s>" : $label;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $metaInfo = \App\Module::getEntityInfo($recordModel->getModuleName());
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $separator = $metaInfo['separator'] ?? ' ';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            if ($recordModel->isNew()) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                        return Cache::staticGet(__METHOD__, $recordNumber);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    Cache::staticSave(__METHOD__, $recordNumber, $id);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (null === $state) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        $dbCommand->delete($labelTableName, ['crmid' => $id])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $label = $metaInfo[$id]['name'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        if ((new \App\Db\Query())->from($labelTableName)->where(['crmid' => $id])->exists()) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                            $dbCommand->update($labelTableName, ['label' => $label], ['crmid' => $id])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @param int    $recordId   - Record ID
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                public static function updateLabelOnSave(\Vtiger_Record_Model $recordModel): void
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                            $labelName[] = $fieldModel->getDisplayValue($recordModel->get($fieldModel->getName()), $recordModel->getId(), $recordModel, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $label = TextUtils::textTruncate(trim(implode($separator, $labelName)), 250, false) ?: '';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 125 characters
            Open

                            $dbCommand->insert('u_#__crmentity_label', ['crmid' => $recordModel->getId(), 'label' => $label])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                                $dbCommand->insert('u_#__crmentity_search_label', ['crmid' => $recordModel->getId(), 'searchlabel' => $search, 'tabid' => $recordModel->getModule()->getId()])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                    return $state;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Get record state.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        return Cache::get(__METHOD__, $recordId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                                $entity = \CRMEntity::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Get parent record.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $index = $entity->tab_name_index[$field['tablename']];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                $parentId = (new \App\Db\Query())->select(["{$field['tablename']}.{$field['columnname']}"])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    ->where(["{$field['tablename']}.{$index}" => $recordId, 'vtiger_crmentity.deleted' => 0])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $entity = \CRMEntity::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        ->scalar();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * @return int|bool
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    $label = $moduleModel->getCustomLinkLabel($id, $label);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 129 characters
            Open

                    $label = "<a class=\"modCT_{$moduleName} showReferenceTooltip js-popover-tooltip--record\" href=\"{$url}\">{$label}</a>";
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $recordModel->label = \App\Purifier::encodeHtml($label);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                 * Get record module name.
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    switch ($metadata['deleted'] ?? 3) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                        ->where(["{$field['tablename']}.{$field['columnname']}" => $recordNumber, 'vtiger_crmentity.deleted' => 0])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $labelTableName = \App\RecordSearch::LABEL_TABLE_NAME;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                            $label = $metaInfo[$id]['search'];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                 * @return void
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            $dbCommand->insert('u_#__crmentity_label', ['crmid' => $recordModel->getId(), 'label' => $label])->execute();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            foreach ($metaInfo['searchcolumnArr'] as $columnName) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 159 characters
            Open

                    return (isset($recordMetaData) && 1 !== $recordMetaData['deleted'] && ($moduleName ? $recordMetaData['setype'] === $moduleName : true)) ? true : false;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $invData = \Vtiger_Inventory_Model::getInventoryDataById($recordId, $moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                            $state = 'Active';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        case 2:
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $index = $entity->tab_name_index[$field['tablename']];
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    if (empty($moduleName)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

                    $state = self::getState($id);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (Cache::has(__METHOD__, $recordId)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $label = self::getLabel($id, true);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (empty($label) && 0 != $label) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if ($id && !Privilege::isPermitted($moduleName, 'DetailView', $id)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        $moduleName = static::getType($recordId);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if ($parentModules = ModuleHierarchy::getModulesMap1M($moduleName)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    ->from($field['tablename'])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                                    ->scalar();
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    return $parentId;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    $label = "<a class=\"modCT_{$moduleName} showReferenceTooltip js-popover-tooltip--record\" href=\"{$url}\">{$label}</a>";
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                public static function getIdByRecordNumber(string $recordNumber, string $moduleName)
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

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

                        ->from($field['tablename'])
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                    $url = $moduleModel->getDetailViewUrl($id);
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

                    return $id;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

            Line exceeds 120 characters; contains 127 characters
            Open

                        return '<i class="color-red-500" title="' . $id . '">' . Language::translate('LBL_RECORD_DOES_NOT_EXIST') . '</i>';
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (null !== $length) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                        foreach ($parentModules as $parentModule) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                            if ($field = Field::getRelatedFieldForModule($moduleName, $parentModule)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    if (Cache::staticHas(__METHOD__, $recordNumber)) {
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

            Line exceeds 120 characters; contains 127 characters
            Open

                public static function getHtmlLink(int $id, ?string $moduleName = null, ?int $length = null, bool $fullUrl = false): string
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

                    $deleted = 'Trash' === $state;
            Severity: Minor
            Found in app/Record.php by phpcodesniffer

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

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

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

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

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

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

            There are no issues that match your filters.

            Category
            Status