YetiForceCompany/YetiForceCRM

View on GitHub
app/Relation.php

Summary

Maintainability
A
3 hrs
Test Coverage
B
83%

Function getByModule has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getByModule(string $moduleName, ?bool $onlyActive = false, ?string $relatedModuleName = null): array
    {
        if (Cache::has('App\Relation::getByModule', $moduleName)) {
            $allRelations = Cache::get('App\Relation::getByModule', $moduleName);
        } else {
Severity: Minor
Found in app/Relation.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 getByModule has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getByModule(string $moduleName, ?bool $onlyActive = false, ?string $relatedModuleName = null): array
    {
        if (Cache::has('App\Relation::getByModule', $moduleName)) {
            $allRelations = Cache::get('App\Relation::getByModule', $moduleName);
        } else {
Severity: Minor
Found in app/Relation.php - About 1 hr to fix

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

        public static function getByModule(string $moduleName, ?bool $onlyActive = false, ?string $relatedModuleName = null): array
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

    See

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

        public static function clearCacheByModule(string $moduleName, bool $child = true): void
    Severity: Minor
    Found in app/Relation.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

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

        public static function clearCacheById(int $relationId, bool $parent = true): void
    Severity: Minor
    Found in app/Relation.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

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

        public static function getByModule(string $moduleName, ?bool $onlyActive = false, ?string $relatedModuleName = null): array
    Severity: Minor
    Found in app/Relation.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'App\Cache' in method 'getByModule'.
    Open

                $allRelations = Cache::get('App\Relation::getByModule', $moduleName);
    Severity: Minor
    Found in app/Relation.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 'getByModule'.
    Open

                Cache::save('App\Relation::getByModule', $moduleName, $allRelations, Cache::LONG);
    Severity: Minor
    Found in app/Relation.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 '150', column '19').
    Open

        public static function clearCacheById(int $relationId, bool $parent = true): void
        {
            if ($parent && ($relation = self::getById($relationId)) && ($moduleName = \App\Module::getModuleName($relation['tabid']))) {
                self::clearCacheByModule($moduleName, false);
            }
    Severity: Minor
    Found in app/Relation.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class 'App\Cache' in method 'getById'.
    Open

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

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

            Cache::save('App\Relation::getById', $relationId, $row, Cache::LONG);
    Severity: Minor
    Found in app/Relation.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 'clearCacheById'.
    Open

            if ($parent && ($relation = self::getById($relationId)) && ($moduleName = \App\Module::getModuleName($relation['tabid']))) {
    Severity: Minor
    Found in app/Relation.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 'clearCacheById'.
    Open

            Cache::delete('getFieldsFromRelation', $relationId);
    Severity: Minor
    Found in app/Relation.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 getById uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $row = [];
            }
    Severity: Minor
    Found in app/Relation.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'App\Cache' in method 'clearCacheByModule'.
    Open

            Cache::delete('App\Relation::getByModule', $moduleName);
    Severity: Minor
    Found in app/Relation.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 'clearCacheByModule'.
    Open

            Cache::delete('HierarchyByRelation', '');
    Severity: Minor
    Found in app/Relation.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 getByModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $allRelations = [];
                $dataReader = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
                    ->from('vtiger_relatedlists')->innerJoin('vtiger_tab', 'vtiger_relatedlists.related_tabid = vtiger_tab.tabid')
                    ->where(['vtiger_relatedlists.tabid' => Module::getModuleId($moduleName)])->orderBy(['sequence' => SORT_ASC])
    Severity: Minor
    Found in app/Relation.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 assigning values to variables in if clauses and the like (line '150', column '63').
    Open

        public static function clearCacheById(int $relationId, bool $parent = true): void
        {
            if ($parent && ($relation = self::getById($relationId)) && ($moduleName = \App\Module::getModuleName($relation['tabid']))) {
                self::clearCacheByModule($moduleName, false);
            }
    Severity: Minor
    Found in app/Relation.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class 'App\Cache' in method 'clearCacheById'.
    Open

            Cache::delete('HierarchyByRelation', '');
    Severity: Minor
    Found in app/Relation.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 'getByModule'.
    Open

                    ->where(['vtiger_relatedlists.tabid' => Module::getModuleId($moduleName)])->orderBy(['sequence' => SORT_ASC])
    Severity: Minor
    Found in app/Relation.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 'getByModule'.
    Open

            if (Cache::has('App\Relation::getByModule', $moduleName)) {
    Severity: Minor
    Found in app/Relation.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 'clearCacheById'.
    Open

            Cache::delete('App\Relation::getById', $relationId);
    Severity: Minor
    Found in app/Relation.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Define a constant instead of duplicating this literal "relation_id" 7 times.
    Open

                    $row['relation_id'] = (int) $row['relation_id'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $row['favorites'] = (int) $row['favorites'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $row['relation_comment'] = (int) $row['relation_comment'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    ->where(['vtiger_relatedlists.tabid' => Module::getModuleId($moduleName)])->orderBy(['sequence' => SORT_ASC])
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                $dataReader = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $row['related_tabid'] = (int) $row['related_tabid'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "App\Relation::getById" 4 times.
    Open

            if (Cache::has('App\Relation::getById', $relationId)) {
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $row['tabid'] = (int) $row['tabid'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $row['creator_detail'] = (int) $row['creator_detail'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "App\Relation::getByModule" 4 times.
    Open

            if (Cache::has('App\Relation::getByModule', $moduleName)) {
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $row['presence'] = (int) $row['presence'];
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                $dataReader = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Critical
    Found in app/Relation.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            Cache::delete('App\Relation::getById', $relationId);
    Severity: Minor
    Found in app/Relation.php by phan

    Doc-block of $relationId in clearCacheById contains phpdoc param type string which is incompatible with the param type int declared in the signature
    Open

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

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

                $dataReader = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Critical
    Found in app/Relation.php by phan

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

            Cache::save('App\Relation::getById', $relationId, $row, Cache::LONG);
    Severity: Minor
    Found in app/Relation.php by phan

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

            Cache::delete('getFieldsFromRelation', $relationId);
    Severity: Minor
    Found in app/Relation.php by phan

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

            $row = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Critical
    Found in app/Relation.php by phan

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

            if (Cache::has('App\Relation::getById', $relationId)) {
    Severity: Minor
    Found in app/Relation.php by phan

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

                return Cache::get('App\Relation::getById', $relationId);
    Severity: Minor
    Found in app/Relation.php by phan

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

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

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

        public static function getByModule(string $moduleName, ?bool $onlyActive = false, ?string $relatedModuleName = null): array
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                    $row['tabid'] = (int) $row['tabid'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $row['creator_detail'] = (int) $row['creator_detail'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

         * @param bool|null   $onlyActive
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                    ->from('vtiger_relatedlists')->innerJoin('vtiger_tab', 'vtiger_relatedlists.related_tabid = vtiger_tab.tabid')
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $row['favorites'] = (int) $row['favorites'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

                    $row['sequence'] = (int) $row['sequence'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

    Line exceeds 120 characters; contains 127 characters
    Open

        public static function getByModule(string $moduleName, ?bool $onlyActive = false, ?string $relatedModuleName = null): array
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    ->createCommand()->query();
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

    Line exceeds 120 characters; contains 125 characters
    Open

                    ->where(['vtiger_relatedlists.tabid' => Module::getModuleId($moduleName)])->orderBy(['sequence' => SORT_ASC])
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $row['relation_id'] = (int) $row['relation_id'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                $allRelations = Cache::get('App\Relation::getByModule', $moduleName);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $dataReader = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $row['related_tabid'] = (int) $row['related_tabid'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    ->where(['vtiger_relatedlists.tabid' => Module::getModuleId($moduleName)])->orderBy(['sequence' => SORT_ASC])
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

            if (Cache::has('App\Relation::getByModule', $moduleName)) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

    Line exceeds 120 characters; contains 172 characters
    Open

                $dataReader = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

    Line exceeds 120 characters; contains 126 characters
    Open

                    ->from('vtiger_relatedlists')->innerJoin('vtiger_tab', 'vtiger_relatedlists.related_tabid = vtiger_tab.tabid')
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $row['presence'] = (int) $row['presence'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

         * Get all relation for module.
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

         * @param string|null $relatedModuleName
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                foreach ($allRelations as $relationId => $relations) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

         * Get relation by id.
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

         * Function clear cache by module name.
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

            Cache::delete('App\Relation::getById', $relationId);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

            Cache::delete('HierarchyByRelation', '');
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                ->from('vtiger_relatedlists')->innerJoin('vtiger_tab', 'vtiger_relatedlists.related_tabid = vtiger_tab.tabid')
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['presence'] = (int) $row['presence'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Line exceeds 120 characters; contains 161 characters
    Open

            $row = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['relation_id'] = (int) $row['relation_id'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                if (isset($fieldName) && $fieldName === $relation['field_name']) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

    Line exceeds 120 characters; contains 132 characters
    Open

            if ($parent && ($relation = self::getById($relationId)) && ($moduleName = \App\Module::getModuleName($relation['tabid']))) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

        public static function getRelationId(string $moduleName, string $relModuleName, ?string $fieldName = null): ?int
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

         * Function clear cache by module name.
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                Cache::save('App\Relation::getByModule', $moduleName, $allRelations, Cache::LONG);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

            Cache::save('App\Relation::getById', $relationId, $row, Cache::LONG);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Cache::delete('App\Relation::getByModule', $moduleName);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                ->where(['vtiger_relatedlists.relation_id' => $relationId])->one();
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

            return $relationId;
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

        public static function clearCacheByModule(string $moduleName, bool $child = true): void
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                foreach (self::getByModule($moduleName) as $relation) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $row['relation_comment'] = (int) $row['relation_comment'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    if (0 !== $relations['related_module_presence']) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

        public static function getById(int $relationId): array
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

            return $row;
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

         * Get relation id by modules.
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

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

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

            if ($parent && ($relation = self::getById($relationId)) && ($moduleName = \App\Module::getModuleName($relation['tabid']))) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                self::clearCacheByModule($moduleName, false);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                        unset($allRelations[$relationId]);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

            if (Cache::has('App\Relation::getById', $relationId)) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

    Line exceeds 120 characters; contains 122 characters
    Open

                ->from('vtiger_relatedlists')->innerJoin('vtiger_tab', 'vtiger_relatedlists.related_tabid = vtiger_tab.tabid')
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['tabid'] = (int) $row['tabid'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['sequence'] = (int) $row['sequence'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['creator_detail'] = (int) $row['creator_detail'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['relation_comment'] = (int) $row['relation_comment'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

            foreach (self::getByModule($moduleName, true, $relModuleName) as $key => $relation) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

                foreach ($allRelations as $relationId => $relations) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

        public static function clearCacheById(int $relationId, bool $parent = true): void
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                    if ($relatedModuleName !== $relations['related_modulename']) {
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

            $row = (new Db\Query())->select(['vtiger_relatedlists.*', 'related_modulename' => 'vtiger_tab.name', 'related_module_presence' => 'vtiger_tab.presence'])
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    return $key;
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

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

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

            $relationId = null;
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

            return $allRelations;
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                return Cache::get('App\Relation::getById', $relationId);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                $row['favorites'] = (int) $row['favorites'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                        unset($allRelations[$relationId]);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

         * @param string|null $fieldName
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

            Cache::delete('HierarchyByRelation', '');
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    $allRelations[$row['relation_id']] = $row;
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

                $row['related_tabid'] = (int) $row['related_tabid'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

                    self::clearCacheById($relation['relation_id'], false);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

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

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

                $relationId = $relation['relation_id'];
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

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

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

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

            Cache::delete('getFieldsFromRelation', $relationId);
    Severity: Minor
    Found in app/Relation.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status