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';
- Read upRead up
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);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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';
}
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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())) {
- Read upRead up
- Exclude checks
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),
- Read upRead up
- Exclude checks
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),
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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())) {
- Read upRead up
- Exclude checks
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())) {
- Read upRead up
- Exclude checks
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'));
- Read upRead up
- Exclude checks
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'))) {
- Read upRead up
- Exclude checks
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'))) {
- Read upRead up
- Exclude checks
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 = '';
- Read upRead up
- Exclude checks
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),
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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'));
- Read upRead up
- Exclude checks
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';
}
- Read upRead up
- Exclude checks
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';
}
- Read upRead up
- Exclude checks
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'))) {
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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),
- Read upRead up
- Exclude checks
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')) {
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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')) {
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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'))) {
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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()) {
- Read upRead up
- Exclude checks
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'));
- Exclude checks
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())) {
- Exclude checks
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())) {
- Exclude checks
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'));
- Exclude checks
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())) {
- Exclude checks
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);
- Exclude checks
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
- Exclude checks
The class Vtiger_InterestsConflict_Action is not named in CamelCase. Open
class Vtiger_InterestsConflict_Action extends \App\Controller\Action
{
use \App\Controller\ExposeMethod;
/** {@inheritdoc} */
- Read upRead up
- Exclude checks
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');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('usersCancel');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Components\InterestsConflict::setCancel($request->getInteger('id'), $baseRecord, $request->getByType('comment', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = 'LBL_RELATION_NOT_FOUND';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Unlock access request.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function unlock(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $request->getInteger('value');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = 'LBL_SENT';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($value > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = 'LBL_RELATION_NOT_FOUND';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkPermission(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseType = 'success';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => \App\Language::translate($responseMessage),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'usersCancel':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
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'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Confirmation request.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceRecord = $request->getInteger('sourceRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseType = 'success';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = 'LBL_RELATION_NOT_FOUND';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = 'LBL_SENT';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($request->getMode()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function usersCancel(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent = \App\Components\InterestsConflict::getParent($sourceRecord, $request->getModule())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => $responseType,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceRecord = $request->getInteger('sourceRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Components\InterestsConflict::unlock($baseRecord, $sourceRecord, $request->getByType('comment', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseMessage = 'LBL_INTERESTS_CONFLICT_UNLOCK_RESP';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => \App\Language::translate($responseMessage),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => $responseType,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function confirmation(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent['id'] !== $baseRecord || $parent['moduleName'] !== $request->getByType('baseModuleName', 'Alnum')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Components\InterestsConflict::confirmation($baseRecord, $sourceRecord, $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('confirmation');
- Exclude checks
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'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseRecord = $request->getInteger('baseRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseRecord = $request->getInteger('baseRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseType = 'success';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseRecord = $request->getInteger('baseRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||value||$value", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
\App\Components\InterestsConflict::setCancel($request->getInteger('id'), $baseRecord, $request->getByType('comment', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
\App\Components\InterestsConflict::unlock($baseRecord, $sourceRecord, $request->getByType('comment', 'Text'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseType = 'error';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cancel user confirmation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceRecord = $request->getInteger('sourceRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseType = 'error';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => \App\Language::translate($responseMessage),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
use \App\Controller\ExposeMethod;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$responseType = 'error';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => $responseType,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Class name "Vtiger_InterestsConflict_Action" is not in camel caps format Open
class Vtiger_InterestsConflict_Action extends \App\Controller\Action
- Exclude checks