Function getPrivileges
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getPrivileges($userId)
{
$recordId = false;
if (!empty($this->get('sourceRecord'))) {
$recordId = $this->get('sourceRecord');
- 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
Method getPrivileges
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPrivileges($userId)
{
$recordId = false;
if (!empty($this->get('sourceRecord'))) {
$recordId = $this->get('sourceRecord');
Avoid using static access to class '\App\Language' in method 'getPrivileges'. Open
$profileNames[] = \App\Language::translate($profile->getName(), 'Settings::Profiles');
- 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 '\vtlib\Functions' in method 'getParameters'. Open
$metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('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 'Vtiger_Watchdog_Model' in method 'getWatchdog'. Open
$watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);
- 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\Log' in method 'getPrivileges'. Open
\App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);
- 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 'getPrivileges'. Open
'isPermitted' => \App\Privilege::isPermitted($this->get('sourceModule'), $action, $recordId, $userId),
- 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\Fields\Owner' in method 'getParameters'. Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- 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 'Vtiger_Watchdog_Model' in method 'getWatchdog'. Open
$watchdog = Vtiger_Watchdog_Model::getInstance($this->get('sourceModule'), $userId);
- 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 'getParameters'. Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- 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 'getParameters'. Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- 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\User' in method 'getPrivileges'. Open
$userModel = \App\User::getUserModel($userId);
- 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 getPrivileges uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;
\App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);
}
- 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 '\vtlib\Functions' in method 'getParameters'. Open
$metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('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\Fields\Owner' in method 'getParameters'. Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- 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\Fields\Owner' in method 'getUsersPermission'. Open
$fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));
- 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 'getPrivileges'. Open
$profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;
- 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\Log' in method 'getPrivileges'. Open
\App\Log::error($th->__toString(), 'PermissionInspector');
- 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 '47', column '9'). Open
public function getPrivileges($userId)
{
$recordId = false;
if (!empty($this->get('sourceRecord'))) {
$recordId = $this->get('sourceRecord');
- 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 assigning values to variables in if clauses and the like (line '45', column '22'). Open
public function getPrivileges($userId)
{
$recordId = false;
if (!empty($this->get('sourceRecord'))) {
$recordId = $this->get('sourceRecord');
- 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 'Settings_Profiles_Record_Model' in method 'getPrivileges'. Open
if ($profile = Settings_Profiles_Record_Model::getInstanceById($profileId)) {
- 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 getWatchdog uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);
$watchdog->remove('isWatchingRecord');
$watchdog->remove('isWatchingModule');
$active = $watchdog->isWatchingRecord();
- 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 "sourceRecord" 6 times. Open
if (!empty($this->get('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 "param" 3 times. Open
'param' => $th->getMessage(),
- 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 "sourceModule" 4 times. Open
$fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));
- 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.
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error($th->__toString(), 'PermissionInspector');
- Exclude checks
Call to method getLabel
from undeclared class \App\Fields\Owner
Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \App\User::getUserModel($userId);
- Exclude checks
Call to method getLabel
from undeclared class \App\Fields\Owner
Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- Exclude checks
This case's code block is the same as the block for the case on line 85. Open
case 'SEC_RECORD_OWNER_CURRENT_USER':
$metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
break;
- Read upRead up
- Exclude checks
Having two cases
in a switch
statement or two branches in an if
chain with the same implementation is at
best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if
chain they should
be combined, or for a switch
, one should fall through to the other.
Noncompliant Code Example
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: // Noncompliant; duplicates case 1's implementation doSomething(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThing(); // Noncompliant; duplicates first condition } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doOneMoreThing(); // Noncompliant; duplicates then-branch } var b = a ? 12 > 4 : 4; // Noncompliant; always results in the same value
Compliant Solution
switch ($i) { case 1: case 3: doSomething(); break; case 2: doSomethingDifferent(); break; default: doTheRest(); } if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else { doTheRest(); } doOneMoreThing(); b = 4;
or
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: doThirdThing(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThirdThing(); } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doTheRest(); } int b = a ? 12 > 4 : 8;
Exceptions
Blocks in an if
chain that contain a single line of code are ignored, as are blocks in a switch
statement that contain a
single line of code with or without a following break
.
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class PermissionInspector_Module_Model extends Vtiger_Module_Model
- Exclude checks
The class PermissionInspector_Module_Model is not named in CamelCase. Open
class PermissionInspector_Module_Model extends Vtiger_Module_Model
{
/**
* Get users permissions.
*
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileNames = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error($th->__toString(), 'PermissionInspector');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'isPermitted' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list = [];
- 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
'profiles' => implode(',', $profileNames),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list[$userId] = [
- 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
public function getPrivileges($userId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'param' => $th->getMessage(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('LBL_PROFILE_DOES_NOT_EXIST: ' . $profileId);
- 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
foreach ($profiles as $profileId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'isPermitted' => \App\Privilege::isPermitted($this->get('sourceModule'), $action, $recordId, $userId),
- 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
'privileges' => $this->getPrivileges($userId),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($profile = Settings_Profiles_Record_Model::getInstanceById($profileId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$watchdog->remove('isWatchingRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userId
- 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
switch ($privileges['accessLog']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWatchdog($userId)
- 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 $list;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get privileges by user id.
- 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
case 'SEC_RECORD_OWNER_CURRENT_GROUP':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $privileges;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'watchdog' => $this->getWatchdog($userId),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions[$action] = $this->getParameters([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getParameters($privileges)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$privileges['param'] = \App\Language::translate(\App\Fields\Owner::getLabel($metadata['smownerid']));
- 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
} else {
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
'isPermitted' => \App\Privilege::isPermitted($this->get('sourceModule'), $action, $recordId, $userId),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $permissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$watchdog = Vtiger_Watchdog_Model::getInstance($this->get('sourceModule'), $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['active' => $active];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldOwner->getAccessibleUsers() as $userId => $userName) {
- 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
case 'SEC_RECORD_OWNER_CURRENT_USER':
- 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
* Get watchdog by user id.
- 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
* Get users permissions.
- 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 getUsersPermission()
- 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
$fieldOwner = \App\Fields\Owner::getInstance($this->get('sourceModule'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'userName' => $userName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userModel && ($profiles = $userModel->getProfiles())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profiles' => implode(',', $profileNames),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$watchdog->remove('isWatchingModule');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$active = $watchdog->isWatchingRecord();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- 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
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'accessLog' => \App\Privilege::$isPermittedLevel,
- 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
* @return array
- 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
break;
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$watchdog = Vtiger_Watchdog_Model::getInstanceById($this->get('sourceRecord'), $this->get('sourceModule'), $userId);
- 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
$recordId = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->get('sourceRecord'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $this->get('sourceRecord');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->get('actions') as $action) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions[$action] = [
- 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 array $privileges
- 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
default:
- 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
$active = $watchdog->isWatchingModule();
- 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
$profileNames[] = \App\Language::translate($profile->getName(), 'Settings::Profiles');
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$profileNames[] = \App\Language::translate('LBL_PROFILE_DOES_NOT_EXIST', 'Settings::Profiles') . ':' . $profileId;
- 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
$metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->get('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
$userModel = \App\User::getUserModel($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $th) {
- 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
* Get additional parameters.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$metadata = \vtlib\Functions::getCRMRecordMetadata($this->get('sourceRecord'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- 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
$watchdog->remove('isWatchingModule');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "PermissionInspector_Module_Model" is not in camel caps format Open
class PermissionInspector_Module_Model extends Vtiger_Module_Model
- Exclude checks