YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/actions/InterestsConflict.php

Summary

Maintainability
A
35 mins
Test Coverage
F
0%

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

    public function confirmation(App\Request $request): void
    {
        $sourceRecord = $request->getInteger('sourceRecord');
        $baseRecord = $request->getInteger('baseRecord');
        $responseType = 'success';
Severity: Minor
Found in modules/Vtiger/actions/InterestsConflict.php - About 35 mins to fix

Cognitive Complexity

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

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

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

Further reading

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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 '120', column '15').
Open

                throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||value||$value", 406);

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 '128', column '19').
Open

        $response = new Vtiger_Response();

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 '86', column '15').
Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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 '35', column '16').
Open

                    throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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 '94', column '19').
Open

        $response = new Vtiger_Response();

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 '56', column '15').
Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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 '64', column '19').
Open

        $response = new Vtiger_Response();

MissingImport

Since: 2.7.0

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

Example

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

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

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

        } else {
            $responseMessage = 'LBL_RELATION_NOT_FOUND';
            $responseType = 'error';
        }

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\Components\InterestsConflict' in method 'confirmation'.
Open

            \App\Components\InterestsConflict::confirmation($baseRecord, $sourceRecord, $value);

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\Components\InterestsConflict' in method 'usersCancel'.
Open

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

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

            'message' => \App\Language::translate($responseMessage),

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

            'message' => \App\Language::translate($responseMessage),

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

    public function confirmation(App\Request $request): void
    {
        $sourceRecord = $request->getInteger('sourceRecord');
        $baseRecord = $request->getInteger('baseRecord');
        $responseType = 'success';

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\Components\InterestsConflict' in method 'unlock'.
Open

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

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\Components\InterestsConflict' in method 'confirmation'.
Open

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

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\Components\InterestsConflict' in method 'unlock'.
Open

            \App\Components\InterestsConflict::unlock($baseRecord, $sourceRecord, $request->getByType('comment', 'Text'));

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class '\App\Privilege' in method 'checkPermission'.
Open

                if (!\App\Privilege::isPermitted($request->getModule(), 'InterestsConflictUsers') || !\App\Privilege::isPermitted($request->getByType('sourceModuleName', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class '\App\Privilege' in method 'checkPermission'.
Open

                if (!\App\Privilege::isPermitted($request->getModule(), 'InterestsConflictUsers') || !\App\Privilege::isPermitted($request->getByType('sourceModuleName', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {

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

    public function usersCancel(App\Request $request): void
    {
        $sourceRecord = $request->getInteger('sourceRecord');
        $baseRecord = $request->getInteger('baseRecord');
        $responseMessage = '';

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\Language' in method 'usersCancel'.
Open

            'message' => \App\Language::translate($responseMessage),

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

    public function unlock(App\Request $request): void
    {
        $sourceRecord = $request->getInteger('sourceRecord');
        $baseRecord = $request->getInteger('baseRecord');
        $responseType = 'success';

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\Components\InterestsConflict' in method 'usersCancel'.
Open

            \App\Components\InterestsConflict::setCancel($request->getInteger('id'), $baseRecord, $request->getByType('comment', 'Text'));

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

        } else {
            $responseMessage = 'LBL_RELATION_NOT_FOUND';
            $responseType = 'error';
        }

ElseExpression

Since: 1.4.0

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

Example

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

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

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

        } else {
            $responseMessage = 'LBL_RELATION_NOT_FOUND';
            $responseType = 'error';
        }

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

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

                if (!\App\Privilege::isPermitted($request->getModule(), 'InterestsConflictUsers') || !\App\Privilege::isPermitted($request->getByType('sourceModuleName', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {

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

            $responseMessage = 'LBL_RELATION_NOT_FOUND';

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

            'message' => \App\Language::translate($responseMessage),

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

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

            $responseType = 'error';

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

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

                if (!\App\Privilege::isPermitted($request->getModule(), 'InterestsConflictUsers') || !\App\Privilege::isPermitted($request->getByType('sourceModuleName', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {

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

        $responseType = 'success';

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

        $baseRecord = $request->getInteger('baseRecord');

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.

Add a "case default" clause to this "switch" statement.
Open

        switch ($request->getMode()) {

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

Noncompliant Code Example

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

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

Compliant Solution

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

See

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

Call to method unlock from undeclared class \App\Components\InterestsConflict (Did you mean class \App\Controller\Components\Action\InterestsConflict or class \App\Controller\Components\View\InterestsConflict)
Open

            \App\Components\InterestsConflict::unlock($baseRecord, $sourceRecord, $request->getByType('comment', 'Text'));

Call to method getParent from undeclared class \App\Components\InterestsConflict (Did you mean class \App\Controller\Components\Action\InterestsConflict or class \App\Controller\Components\View\InterestsConflict)
Open

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

Call to method getParent from undeclared class \App\Components\InterestsConflict (Did you mean class \App\Controller\Components\Action\InterestsConflict or class \App\Controller\Components\View\InterestsConflict)
Open

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

Call to method setCancel from undeclared class \App\Components\InterestsConflict (Did you mean class \App\Controller\Components\Action\InterestsConflict or class \App\Controller\Components\View\InterestsConflict)
Open

            \App\Components\InterestsConflict::setCancel($request->getInteger('id'), $baseRecord, $request->getByType('comment', 'Text'));

Call to method getParent from undeclared class \App\Components\InterestsConflict (Did you mean class \App\Controller\Components\Action\InterestsConflict or class \App\Controller\Components\View\InterestsConflict)
Open

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

Call to method confirmation from undeclared class \App\Components\InterestsConflict (Did you mean class \App\Controller\Components\Action\InterestsConflict or class \App\Controller\Components\View\InterestsConflict)
Open

            \App\Components\InterestsConflict::confirmation($baseRecord, $sourceRecord, $value);

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

class Vtiger_InterestsConflict_Action extends \App\Controller\Action

The class Vtiger_InterestsConflict_Action is not named in CamelCase.
Open

class Vtiger_InterestsConflict_Action extends \App\Controller\Action
{
    use \App\Controller\ExposeMethod;

    /** {@inheritdoc} */

CamelCaseClassName

Since: 0.2

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

Example

class class_name {
}

Source

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

        $this->exposeMethod('unlock');

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

        $this->exposeMethod('usersCancel');

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\Components\InterestsConflict::setCancel($request->getInteger('id'), $baseRecord, $request->getByType('comment', 'Text'));

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

            $responseMessage = 'LBL_RELATION_NOT_FOUND';

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

        $response->setResult([

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

    public function unlock(App\Request $request): void

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 = $request->getInteger('value');

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

                    throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

            $responseMessage = 'LBL_SENT';

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

            if ($value > 1) {

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

            $responseMessage = 'LBL_RELATION_NOT_FOUND';

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

        $response->setResult([

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

     * @param App\Request $request

Line exceeds 120 characters; contains 124 characters
Open

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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 function checkPermission(App\Request $request)

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

        $responseType = 'success';

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

        $response->emit();

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 ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

Line exceeds 120 characters; contains 124 characters
Open

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

            'message' => \App\Language::translate($responseMessage),

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

            case 'usersCancel':

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

    {

Line exceeds 120 characters; contains 234 characters
Open

                if (!\App\Privilege::isPermitted($request->getModule(), 'InterestsConflictUsers') || !\App\Privilege::isPermitted($request->getByType('sourceModuleName', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {

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

                }

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

     */

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

     * Confirmation request.

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

        $sourceRecord = $request->getInteger('sourceRecord');

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

    {

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

        $responseType = 'success';

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

     * @param App\Request $request

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

     *

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

            $responseMessage = 'LBL_RELATION_NOT_FOUND';

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

            }

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

        } else {

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

    public function __construct()

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

        $responseMessage = '';

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

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

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

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

            }

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

            $responseMessage = 'LBL_SENT';

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

        switch ($request->getMode()) {

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

     *

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

    public function usersCancel(App\Request $request): void

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

        if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {

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

            'type' => $responseType,

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

        $sourceRecord = $request->getInteger('sourceRecord');

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

            \App\Components\InterestsConflict::unlock($baseRecord, $sourceRecord, $request->getByType('comment', 'Text'));

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 ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

            $responseMessage = 'LBL_INTERESTS_CONFLICT_UNLOCK_RESP';

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

        }

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

            'message' => \App\Language::translate($responseMessage),

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

    }

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

            'type' => $responseType,

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

        ]);

Line exceeds 120 characters; contains 124 characters
Open

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

        $response->emit();

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

    public function confirmation(App\Request $request): void

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

            if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

            \App\Components\InterestsConflict::confirmation($baseRecord, $sourceRecord, $value);

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

        $this->exposeMethod('confirmation');

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

                if (!\App\Privilege::isPermitted($request->getModule(), 'InterestsConflictUsers') || !\App\Privilege::isPermitted($request->getByType('sourceModuleName', 'Alnum'), 'DetailView', $request->getInteger('sourceRecord'))) {

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

        $response = new Vtiger_Response();

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

    {

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

        $baseRecord = $request->getInteger('baseRecord');

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

        $baseRecord = $request->getInteger('baseRecord');

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

        $responseType = 'success';

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

     *

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

     * @param App\Request $request

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

        $baseRecord = $request->getInteger('baseRecord');

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

                throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||value||$value", 406);

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

        $response = new Vtiger_Response();

Line exceeds 120 characters; contains 138 characters
Open

            \App\Components\InterestsConflict::setCancel($request->getInteger('id'), $baseRecord, $request->getByType('comment', 'Text'));

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

     * @return void

Line exceeds 120 characters; contains 122 characters
Open

            \App\Components\InterestsConflict::unlock($baseRecord, $sourceRecord, $request->getByType('comment', 'Text'));

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

            $responseType = 'error';

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

        $response->setResult([

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

    }

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

    /** {@inheritdoc} */

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

     * Cancel user confirmation.

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

        $sourceRecord = $request->getInteger('sourceRecord');

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

            $responseType = 'error';

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

        $response = new Vtiger_Response();

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

            'message' => \App\Language::translate($responseMessage),

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

        }

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

    use \App\Controller\ExposeMethod;

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

    /** {@inheritdoc} */

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

        parent::__construct();

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

            $responseType = 'error';

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

            'type' => $responseType,

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

        $response->emit();

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

class Vtiger_InterestsConflict_Action extends \App\Controller\Action

There are no issues that match your filters.

Category
Status