YetiForceCompany/YetiForceCRM

View on GitHub
app/Components/InterestsConflict.php

Summary

Maintainability
D
2 days
Test Coverage
F
1%

Function getModules has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getModules(): array
    {
        $cacheName = 'InterestsConflict::getModules';
        if (\App\Cache::has($cacheName, '')) {
            return \App\Cache::get($cacheName, '');
Severity: Minor
Found in app/Components/InterestsConflict.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 InterestsConflict has an overall complexity of 54 which is very high. The configured complexity threshold is 50.
Open

class InterestsConflict
{
    /** @var int */
    public const CONF_STATUS_CONFLICT_NO = 0;
    /** @var int */
Severity: Minor
Found in app/Components/InterestsConflict.php by phpmd

Method getModules has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getModules(): array
    {
        $cacheName = 'InterestsConflict::getModules';
        if (\App\Cache::has($cacheName, '')) {
            return \App\Cache::get($cacheName, '');
Severity: Major
Found in app/Components/InterestsConflict.php - About 3 hrs to fix

    File InterestsConflict.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Conflict of interest component file.
     *
    Severity: Minor
    Found in app/Components/InterestsConflict.php - About 2 hrs to fix

      Function getParent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getParent(int $record, string $moduleName): ?array
          {
              if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
                  return ['id' => $record, 'moduleName' => $moduleName];
              }
      Severity: Minor
      Found in app/Components/InterestsConflict.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 updateUnlockStatus has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function updateUnlockStatus(int $id, int $status): void
          {
              \App\Db::getInstance()
                  ->createCommand()
                  ->update('u_#__interests_conflict_unlock', [
      Severity: Minor
      Found in app/Components/InterestsConflict.php - About 1 hr to fix

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

            public static function getParent(int $record, string $moduleName): ?array
            {
                if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
                    return ['id' => $record, 'moduleName' => $moduleName];
                }
        Severity: Minor
        Found in app/Components/InterestsConflict.php - About 1 hr to fix

          Function check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function check(int $record, string $moduleName): int
              {
                  if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
                      return self::CHECK_STATUS_INACTIVE;
                  }
          Severity: Minor
          Found in app/Components/InterestsConflict.php - About 55 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

          Avoid too many return statements within this method.
          Open

                  return self::CONF_STATUS_CONFLICT_YES === $row['status'] ? self::CHECK_STATUS_CONFLICT : self::CHECK_STATUS_NO_CONFLICT;
          Severity: Major
          Found in app/Components/InterestsConflict.php - About 30 mins to fix

            Function getLast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getLast(int $record, ?int $userId = null): ?array
                {
                    if (null === $userId) {
                        $userId = \App\User::getCurrentUserRealId();
                    }
            Severity: Minor
            Found in app/Components/InterestsConflict.php - About 25 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 getModules() has an NPath complexity of 2016. The configured NPath complexity threshold is 200.
            Open

                public static function getModules(): array
                {
                    $cacheName = 'InterestsConflict::getModules';
                    if (\App\Cache::has($cacheName, '')) {
                        return \App\Cache::get($cacheName, '');
            Severity: Minor
            Found in app/Components/InterestsConflict.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 getModules() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
            Open

                public static function getModules(): array
                {
                    $cacheName = 'InterestsConflict::getModules';
                    if (\App\Cache::has($cacheName, '')) {
                        return \App\Cache::get($cacheName, '');
            Severity: Minor
            Found in app/Components/InterestsConflict.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

            Avoid using undefined variables such as '$modules' which will lead to PHP notices.
            Open

                    foreach (\Config\Components\InterestsConflict::$modules[$moduleName] ?? [] as $item) {
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

            Avoid using undefined variables such as '$modules' which will lead to PHP notices.
            Open

                    if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

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

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

            class InterestsConflict
            {
                /** @var int */
                public const CONF_STATUS_CONFLICT_NO = 0;
                /** @var int */
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '154', column '15').
            Open

                    $row = (new \App\Db\Query())
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '280', column '15').
            Open

                    $row = (new \App\Db\Query())->select(['related_id', 'user_id'])->from('u_#__interests_conflict_unlock')->where(['id' => $id])->one();
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '238', column '15').
            Open

                    $all = (new \App\Db\Query())
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                            'user_id' => \App\User::getCurrentUserRealId(),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '64', column '8').
            Open

                public static function check(int $record, string $moduleName): int
                {
                    if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
                        return self::CHECK_STATUS_INACTIVE;
                    }
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

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

                        'modify_user_id' => \App\User::getCurrentUserRealId(),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'updateUnlockStatus'.
            Open

                            'status' => \App\Language::translate(self::UNLOCK_STATUS_LABELS[$status], '_Base', $userModel->getDetail('language')),
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        ->where(['user_id' => \App\User::getCurrentUserRealId(), 'related_id' => $baseRecord])
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        'related_label' => \App\Record::getLabel($baseRecord),
            Severity: Minor
            Found in app/Components/InterestsConflict.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\Mailer' in method 'updateUnlockStatus'.
            Open

                        \App\Mailer::sendFromTemplate([
                            'template' => 'InterestsConflictAccessResponse',
                            'moduleName' => 'Users',
                            'recordId' => $row['user_id'],
                            'to' => $userModel->getDetail('email1'),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getByRecord'.
            Open

                    return \App\Cache::save($cacheName, $record, $row);
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            'record' => \App\Record::getHtmlLink($baseRecord),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '134', column '9').
            Open

                public static function getParent(int $record, string $moduleName): ?array
                {
                    if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
                        return ['id' => $record, 'moduleName' => $moduleName];
                    }
            Severity: Minor
            Found in app/Components/InterestsConflict.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\ModuleHierarchy' in method 'getParent'.
            Open

                    if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        if (($relatedModuleName = \App\Record::getType($relatedId)) && $relatedModuleName === $item['base']) {
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            'modify_user_id' => \App\User::getCurrentUserRealId(),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '71', column '9').
            Open

                public static function check(int $record, string $moduleName): int
                {
                    if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
                        return self::CHECK_STATUS_INACTIVE;
                    }
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

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

                        'modify_user_id' => \App\User::getCurrentUserRealId(),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                        return \App\Cache::get($cacheName, '');
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                                    'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
            Severity: Minor
            Found in app/Components/InterestsConflict.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\Json' in method 'getModules'.
            Open

                                        'value' => \App\Json::encode([
                                            'base' => $parent['base'],
                                            'intermediate' => $targetModuleName,
                                            'intermediateFieldName' => $parent['field']['fieldname'],
                                            'related' => $sourceModuleName,
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                                        'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'confirmation'.
            Open

                    \App\Cache::delete('InterestsConflict::getByRecord', $baseRecord);
            Severity: Minor
            Found in app/Components/InterestsConflict.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\Json' in method 'getModules'.
            Open

                                'value' => \App\Json::encode([
                                    'related' => $moduleName,
                                ]),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'check'.
            Open

                    if (0 !== \App\ModuleHierarchy::getModuleLevel($moduleName)) {
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        $relatedModuleName = \App\Record::getType($recordModel->get($item['relatedFieldName']));
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        $userModel = \App\User::getUserModel($row['user_id']);
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        $userId = \App\User::getCurrentUserRealId();
            Severity: Minor
            Found in app/Components/InterestsConflict.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\Log' in method 'check'.
            Open

                            \App\Log::warning("No parent record could be found |$record|$moduleName", __METHOD__);
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getByRecord'.
            Open

                    if (\App\Cache::has($cacheName, $record)) {
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        'user_id' => \App\User::getCurrentUserRealId(),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'updateUnlockStatus'.
            Open

                            \App\Cache::delete('InterestsConflict::getByRecord', $row['related_id']);
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                                'map' => \App\Language::translateSingularModuleName($moduleName),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            \App\Log::warning("No parent record could be found |$record|$moduleName", __METHOD__);
                            return self::CHECK_STATUS_INACTIVE;
                        }
            Severity: Minor
            Found in app/Components/InterestsConflict.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 '\Vtiger_Record_Model' in method 'getParent'.
            Open

                    $recordModel = \Vtiger_Record_Model::getInstanceById($record, $moduleName);
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                    if (\App\Cache::has($cacheName, '')) {
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                                    'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                    $relatedFields = \App\Field::getRelatedFieldForModule();
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                                    'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        $intermediateRecordModel = \Vtiger_Record_Model::getCleanInstance($relatedModuleName);
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                                        'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                        if (\App\Module::isModuleActive($moduleName)) {
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getByRecord'.
            Open

                        return \App\Cache::get($cacheName, $record);
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'setCancel'.
            Open

                    \App\Cache::delete('InterestsConflict::getByRecord', $record);
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                                    'modify_user_id' => \App\User::getCurrentUserRealId(),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                    foreach (array_keys(\App\ModuleHierarchy::getModulesByLevel(0)) as $moduleName) {
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                    return \App\Cache::save($cacheName, '', array_merge($start, $return));
            Severity: Minor
            Found in app/Components/InterestsConflict.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\Mailer' in method 'unlock'.
            Open

                        \App\Mailer::sendFromTemplate([
                            'template' => 'InterestsConflictAccessRequest',
                            'to' => \Config\Components\InterestsConflict::$notificationsEmails,
                            'dateTime' => date('Y-m-d H:i:s'),
                            'user' => \App\User::getCurrentUserModel()->getName(),
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                            'record' => \App\Record::getHtmlLink($row['related_id']),
            Severity: Minor
            Found in app/Components/InterestsConflict.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 'getModules'.
            Open

                    $allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
            Severity: Minor
            Found in app/Components/InterestsConflict.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\Json' in method 'getModules'.
            Open

                                    'value' => \App\Json::encode([
                                        'base' => $targetModuleName,
                                        'related' => $sourceModuleName,
                                        'relatedFieldName' => $field['fieldname'],
                                    ]),
            Severity: Minor
            Found in app/Components/InterestsConflict.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

            syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
            Open

                    $allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
            Severity: Critical
            Found in app/Components/InterestsConflict.php by phan

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

                        $intermediateRecordModel = \Vtiger_Record_Model::getCleanInstance($relatedModuleName);
            Severity: Minor
            Found in app/Components/InterestsConflict.php by phpmd

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                public static function updateUnlockStatus(int $id, int $status): void
            Severity: Minor
            Found in app/Components/InterestsConflict.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 = $row['id'];
            Severity: Minor
            Found in app/Components/InterestsConflict.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 $v. Configured minimum length is 3.
            Open

                    $allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
            Severity: Minor
            Found in app/Components/InterestsConflict.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

                    self::UNLOCK_STATUS_REJECTED => 'LBL_INTERESTS_CONFLICT_UNLOCK_STATUS_REJECTED',

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

                 */

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

                    return self::CONF_STATUS_CONFLICT_YES === $row['status'] ? self::CHECK_STATUS_CONFLICT : self::CHECK_STATUS_NO_CONFLICT;

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

                 * @param int      $record

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

                public const CONF_STATUS_CONFLICT_YES = 1;

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

                /** @var int */

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

                public const CHECK_STATUS_CONFIRMATION = 1;

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

                    }

            Line exceeds 120 characters; contains 199 characters
            Open

                    if (0 !== \Config\Components\InterestsConflict::$confirmationTimeInterval && strtotime($row['date_time']) < strtotime('-' . \Config\Components\InterestsConflict::$confirmationTimeInterval)) {

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

                /** @var int */

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

                    self::UNLOCK_STATUS_NEW => 'LBL_INTERESTS_CONFLICT_UNLOCK_STATUS_NEW',

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

                    foreach (self::getByRecord($record) as $value) {

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

                        }

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

                /** @var int */

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

                public const CONF_STATUS_CANCELED = 2;

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

                /** @var int */

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

                    if (0 !== \Config\Components\InterestsConflict::$confirmationTimeInterval && strtotime($row['date_time']) < strtotime('-' . \Config\Components\InterestsConflict::$confirmationTimeInterval)) {

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

                ];

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

                public static function check(int $record, string $moduleName): int

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

                        if ($parent = self::getParent($record, $moduleName)) {

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

                        return self::CHECK_STATUS_CONFIRMATION;

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

                    }

            Line exceeds 120 characters; contains 128 characters
            Open

                    return self::CONF_STATUS_CONFLICT_YES === $row['status'] ? self::CHECK_STATUS_CONFLICT : self::CHECK_STATUS_NO_CONFLICT;

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

                 *

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

                    if (null === $userId) {

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

                public const CHECK_STATUS_NO_CONFLICT = 2;

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

                    self::UNLOCK_STATUS_CANCELED => 'LBL_INTERESTS_CONFLICT_CONFIRM_CANCELED',

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

                /**

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

                            \App\Log::warning("No parent record could be found |$record|$moduleName", __METHOD__);

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

                            return self::CHECK_STATUS_INACTIVE;

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

                    }

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

                    return $row;

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

                }

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

                 *

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

                 * @param string $moduleName

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

                 *

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

                 * @return array|null

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

                        $userId = \App\User::getCurrentUserRealId();

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

                            break;

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

                    }

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

                    self::UNLOCK_STATUS_ACCEPTED => 'LBL_INTERESTS_CONFLICT_UNLOCK_STATUS_ACCEPTED',

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

                 * @param int    $record

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

                 * @param int|null $userId

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

                /** @var int */

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

                /** @var int */

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

                /** @var int */

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

                public const UNLOCK_STATUS_REJECTED = 2;

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

                public const CHECK_STATUS_INACTIVE = 0;

            Line exceeds 120 characters; contains 139 characters
            Open

                    if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {

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

                    if (!($row = self::getLast($record))) {

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

                 */

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

                /**

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

                public const CONF_STATUS_CONFLICT_NO = 0;

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

                /** @var int */

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

                        } else {

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

                        }

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

                public const UNLOCK_STATUS_NEW = 0;

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

                public const UNLOCK_STATUS_ACCEPTED = 1;

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

                 * Check the conflict status.

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

                {

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

                    if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {

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

                public static function getLast(int $record, ?int $userId = null): ?array

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

                        if ($value['user_id'] == $userId && self::CONF_STATUS_CANCELED != $value['status']) {

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

                /** @var int */

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

                public const UNLOCK_STATUS_LABELS = [

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

                 * @return int

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

                    if (0 !== \App\ModuleHierarchy::getModuleLevel($moduleName)) {

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

                 * Get the last conflict of interests information.

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

                /** @var int */

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

                /** @var string[] */

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

                        return self::CHECK_STATUS_INACTIVE;

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

                            $record = $parent['id'];

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

                /**

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

                    }

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

                public const UNLOCK_STATUS_CANCELED = 3;

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

                        return self::CHECK_STATUS_CONFIRMATION;

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

                    }

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

                 *

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

                {

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

                            $row = $value;

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

                /** @var int */

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

                }

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

                 */

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

                 *

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

                 * @return array

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

                    ], ['id' => $row['id']])

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

                            'comment' => nl2br($comment),

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

                        ]);

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

                public const CHECK_STATUS_CONFLICT = 3;

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

                    $row = null;

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

                 * Get parent record id.

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

                            continue;

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

                        }

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

                 *

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

                 */

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

                 *  Cancel user confirmation.

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

                 *

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

                        'date_time' => $row['date_time'],

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

                        'related_id' => $row['related_id'],

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

                        'source_id' => $row['source_id'],

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

                        'comment' => $comment,

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

                /**

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

                            'user' => \App\User::getCurrentUserModel()->getName(),

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

                }

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

                        $execute = $logCreateCommand->insert('b_#__interests_conflict_conf', $row)->execute();

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

                    if (\App\Cache::has($cacheName, $record)) {

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

                    return \App\Cache::save($cacheName, $record, $row);

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

                    $row = self::getLast($record, $userId);

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

                        'status' => self::CONF_STATUS_CANCELED,

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

                    $userCreateCommand->insert('u_#__interests_conflict_unlock', [

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

                 *

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

                            'date_time' => date('Y-m-d H:i:s'),

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

                            'user_id' => \App\User::getCurrentUserRealId(),

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

                        ])->execute();

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

                        \App\Mailer::sendFromTemplate([

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

                 * @param int $baseRecord

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

                {

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

                        if (empty($item['intermediateFieldName'])) {

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

                    }

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

                        ->where(['related_id' => $record])

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

                        ->execute();

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

                    ])->execute();

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

                    }

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

                 * @param int $value

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

                 */

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

                        'date_time' => date('Y-m-d H:i:s'),

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

                        'related_id' => $baseRecord,

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

                    if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {

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

                        if ($recordModel->isEmpty($item['relatedFieldName'])) {

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

                        $relatedModuleName = \App\Record::getType($recordModel->get($item['relatedFieldName']));

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

                            }

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

                            continue;

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

                        }

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

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

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

                        ->all();

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

                }

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

                        ->insert('u_#__interests_conflict_unlock', [

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

                        if ($execute) {

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

                        'status' => $value,

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

                        'user_id' => \App\User::getCurrentUserRealId(),

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

                    }

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

                    $recordModel = \Vtiger_Record_Model::getInstanceById($record, $moduleName);

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

                    return null;

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

                {

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

                        'modify_user_id' => \App\User::getCurrentUserRealId(),

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

                 *

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

                            'related_id' => $baseRecord,

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

                        ->all();

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

                        unset($row['id']);

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

                        'related_label' => \App\Record::getLabel($baseRecord),

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

                 * @param int    $record

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

                {

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

                                return ['id' => $recordModel->get($item['relatedFieldName']), 'moduleName' => $relatedModuleName];

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

                            return ['id' => $relatedId, 'moduleName' => $relatedModuleName];

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

                /**

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

                 * @param int $record

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

                    $cacheName = 'InterestsConflict::getByRecord';

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

                 */

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

                 * @param int    $sourceRecord

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

                    if (\Config\Components\InterestsConflict::$sendMailAccessRequest) {

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

                            $userCreateCommand->delete('u_#__interests_conflict_conf', ['id' => $id])->execute();

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

                 * Get confirmation by record.

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

                 * @param int    $userId

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

                 * @param int    $baseRecord

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

                    \App\Db::getInstance()

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

                 *

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

                 * @return void

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

                        ->from('u_#__interests_conflict_conf')

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

                 *

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

                        $intermediateRecordModel = \Vtiger_Record_Model::getCleanInstance($relatedModuleName);

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

                }

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

                 * @param string $comment

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

                 * @param string $comment

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

                 */

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

                            'dateTime' => date('Y-m-d H:i:s'),

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

                    }

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

                 * @param string $moduleName

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

                    foreach (\Config\Components\InterestsConflict::$modules[$moduleName] ?? [] as $item) {

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

                public static function getByRecord(int $record): array

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

                 * @return void

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

                    $userCreateCommand->update('u_#__interests_conflict_conf', [

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

                {

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

                        ->where(['user_id' => \App\User::getCurrentUserRealId(), 'related_id' => $baseRecord])

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

                            if ($relatedModuleName === $item['base']) {

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

                        $relatedId = $intermediateRecordModel->getValueByField($item['intermediateFieldName']);

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

                {

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

                        return \App\Cache::get($cacheName, $record);

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

                /**

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

                    $userCreateCommand = \App\Db::getInstance()->createCommand();

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

                 * Unlock access request.

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

                 * @param int $sourceRecord

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

                    $logCreateCommand = \App\Db::getInstance('log')->createCommand();

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

                    $userCreateCommand->insert('u_#__interests_conflict_conf', [

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

                    }

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

                        'modify_user_id' => \App\User::getCurrentUserRealId(),

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

                            'comment' => $comment,

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

                    $userCreateCommand = \App\Db::getInstance()->createCommand();

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

                        }

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

                public static function getParent(int $record, string $moduleName): ?array

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

                        $intermediateRecordModel->setId($recordModel->get($item['relatedFieldName']));

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

                        if (($relatedModuleName = \App\Record::getType($relatedId)) && $relatedModuleName === $item['base']) {

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

                public static function setCancel(int $userId, int $record, string $comment): void

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

                        'modify_date_time' => date('Y-m-d H:i:s'),

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

                            'to' => \Config\Components\InterestsConflict::$notificationsEmails,

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

                        if ($relatedModuleName !== $item['intermediate']) {

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

                            continue;

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

                 *

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

                    \App\Cache::delete('InterestsConflict::getByRecord', $record);

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

                /**

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

                 * User confirmation.

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

                 *

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

                        'source_id' => $sourceRecord,

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

                 * @return array|null

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

                        return ['id' => $record, 'moduleName' => $moduleName];

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

                        }

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

                }

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

                        'modify_date_time' => date('Y-m-d H:i:s'),

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

                        ->createCommand()

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

                            'status' => self::UNLOCK_STATUS_NEW,

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

                            'source_id' => $sourceRecord,

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

                public static function confirmation(int $baseRecord, int $sourceRecord, int $value): void

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

                        $id = $row['id'];

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

                 *

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

                        }

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

                        ->from('u_#__interests_conflict_conf')

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

                 * @param int    $record

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

                        'status' => self::UNLOCK_STATUS_CANCELED,

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

                        'user_id' => $row['user_id'],

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

                 * @return void

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

                public static function unlock(int $baseRecord, int $sourceRecord, string $comment): void

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

                            'template' => 'InterestsConflictAccessRequest',

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

                            'record' => \App\Record::getHtmlLink($baseRecord),

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

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

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

                    foreach ($all as $row) {

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

                        $userModel = \App\User::getUserModel($row['user_id']);

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

                        return \App\Cache::get($cacheName, '');

            Line exceeds 120 characters; contains 162 characters
            Open

                    $allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));

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

                                'key' => $key,

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

                                'map' => \App\Language::translateSingularModuleName($moduleName),

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

                        }

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

                    $relatedFields = \App\Field::getRelatedFieldForModule();

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

                                $start[$keys[$row['key']]] = $return[$keys[$row['key']]];

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

                                unset($return[$keys[$row['key']]]);

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

                }

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

                }

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

                                ], ['user_id' => $row['user_id'], 'related_id' => $row['related_id']])

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

                    ])->execute();

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

                /**

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

                            \App\Db::getInstance()

            Line exceeds 120 characters; contains 134 characters
            Open

                            'status' => \App\Language::translate(self::UNLOCK_STATUS_LABELS[$status], '_Base', $userModel->getDetail('language')),

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

                            $baseModules[$moduleName] = $moduleName;

            Line exceeds 120 characters; contains 155 characters
            Open

                            if (isset($baseModules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {

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

                                        'key' => $key,

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

                                            'intermediate' => $targetModuleName,

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

                                            'related' => $sourceModuleName,

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

                    }

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

                 * @param int $id

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

                    \App\Db::getInstance()

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

                        ->update('u_#__interests_conflict_unlock', [

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

                    }

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

                {

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

                            if (isset($baseModules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {

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

                                $modules[$sourceModuleName][] = $return["{$allModules[$sourceModuleName]}|$allModules[$targetModuleName]|$key"] = [

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

                                    ]),

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

                                    'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',

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

                                    'field' => $field,

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

                                foreach ($modules[$targetModuleName] as $parent) {

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

                                        'value' => \App\Json::encode([

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

                    ksort($return);

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

                 * @param int $status

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

                        ->createCommand()

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

                    if (\Config\Components\InterestsConflict::$sendMailAccessResponse) {

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

                            'template' => 'InterestsConflictAccessResponse',

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

                            'record' => \App\Record::getHtmlLink($row['related_id']),

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

                    }

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

                    }

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

                                    $keys[$key] = "{$allModules[$sourceModuleName]}|{$allModules[$parent['base']]}|$key";

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

                                    'modify_date_time' => date('Y-m-d H:i:s'),

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

                        }

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

                    foreach (array_keys(\App\ModuleHierarchy::getModulesByLevel(0)) as $moduleName) {

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

                                    'key' => $key,

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

                                    'target' => $sourceModuleName,

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

                                            'intermediateFieldName' => $parent['field']['fieldname'],

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

                                    'modify_user_id' => \App\User::getCurrentUserRealId(),

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

                            'status' => \App\Language::translate(self::UNLOCK_STATUS_LABELS[$status], '_Base', $userModel->getDetail('language')),

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

                /**

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

                 * Get modules list.

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

                 * @return array

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

                public static function getModules(): array

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

                                        'base' => $targetModuleName,

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

                                        'related' => $sourceModuleName,

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

                        }

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

                        foreach ($forModules as $targetModuleName => $field) {

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

                                    $return["{$allModules[$sourceModuleName]}|{$allModules[$parent['base']]}|$key"] = [

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

                                        ]),

            Line exceeds 120 characters; contains 206 characters
            Open

                                        'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',

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

                 * Update unlock status.

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

                                ->update('u_#__interests_conflict_conf', [

            Line exceeds 120 characters; contains 249 characters
            Open

                                    'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',

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

                            if (isset($modules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {

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

                    foreach (\Config\Components\InterestsConflict::$modules ?? [] as $rows) {

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

                {

            Line exceeds 120 characters; contains 141 characters
            Open

                    $row = (new \App\Db\Query())->select(['related_id', 'user_id'])->from('u_#__interests_conflict_unlock')->where(['id' => $id])->one();

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

                        ]);

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

                    $excludedModules = ['ModComments'];

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

                    $baseModules = $return = $modules = $baseModules = [];

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

                            $key = "$moduleName";

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

                                        'base' => $parent['base'],

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

                                    ];

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

                        foreach ($rows as $row) {

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

                            }

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

                 */

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

                                'target' => $moduleName,

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

                            ];

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

                                $key = "$sourceModuleName({$field['fieldname']})|{$targetModuleName}";

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

                                        'relatedFieldName' => $field['fieldname'],

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

                                        'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',

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

                    }

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

                        }

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

                    return \App\Cache::save($cacheName, '', array_merge($start, $return));

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

                    \App\Cache::delete('InterestsConflict::getByRecord', $baseRecord);

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

                            'status' => $status,

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

                        ->execute();

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

                                    'status' => self::CONF_STATUS_CANCELED,

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

                    if (\App\Cache::has($cacheName, '')) {

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

                                'base' => $moduleName,

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

                    $keys = [];

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

                    foreach ($relatedFields as $sourceModuleName => $forModules) {

            Line exceeds 120 characters; contains 135 characters
            Open

                                $modules[$sourceModuleName][] = $return["{$allModules[$sourceModuleName]}|$allModules[$targetModuleName]|$key"] = [

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

                                    'base' => $targetModuleName,

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

                                $keys[$key] = "{$allModules[$sourceModuleName]}|$allModules[$targetModuleName]|$key";

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

                                }

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

                            }

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

                public static function updateUnlockStatus(int $id, int $status): void

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

                                ->execute();

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

                            'recordId' => $row['user_id'],

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

                }

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

                 *

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

                    }

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

                                            'relatedFieldName' => $field['fieldname'],

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

                 *

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

                 */

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

                            'modify_date_time' => date('Y-m-d H:i:s'),

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

                    $row = (new \App\Db\Query())->select(['related_id', 'user_id'])->from('u_#__interests_conflict_unlock')->where(['id' => $id])->one();

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

                                ];

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

                                            'base' => $parent['base'],

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

                            if (isset($keys[$row['key']])) {

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

                 *

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

                 * @return void

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

                                ->createCommand()

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

                            'to' => $userModel->getDetail('email1'),

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

                    }

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

                                'value' => \App\Json::encode([

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

                                ]),

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

                    $start = [];

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

                            \App\Cache::delete('InterestsConflict::getByRecord', $row['related_id']);

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

                        \App\Mailer::sendFromTemplate([

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

                            'moduleName' => 'Users',

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

                        if (\App\Module::isModuleActive($moduleName)) {

            Line exceeds 120 characters; contains 151 characters
            Open

                            if (isset($modules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {

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

                                        'target' => $sourceModuleName,

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

                        }

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

                            'modify_user_id' => \App\User::getCurrentUserRealId(),

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

                        ], ['id' => $id])

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

                    if (self::UNLOCK_STATUS_ACCEPTED === $status) {

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

                        if ($row) {

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

                    $cacheName = 'InterestsConflict::getModules';

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

                    $allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));

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

                            $return["0000|$key"] = [

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

                                    'related' => $moduleName,

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

                        foreach ($forModules as $targetModuleName => $field) {

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

                                    'value' => \App\Json::encode([

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

                            }

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

                    foreach ($relatedFields as $sourceModuleName => $forModules) {

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

                                    $key = "{$sourceModuleName}({$field['fieldname']})|{$parent['key']}";

            Space before opening parenthesis of function call prohibited
            Open

                    $allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));

            There are no issues that match your filters.

            Category
            Status