File Owner.php
has 616 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Owner class.
*
* @package App
Function transferOwnershipForWorkflow
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private static function transferOwnershipForWorkflow($oldId, $newId)
{
$db = \App\Db::getInstance();
$ownerName = static::getLabel($oldId);
$newOwnerName = static::getLabel($newId);
- 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
Function getUsersAndGroupForModuleList
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_user_id')
{
$queryGenerator = new \App\QueryGenerator($this->moduleName, $this->currentUser->getId());
if ($view) {
$queryGenerator->initForCustomViewById($view);
- 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
The class Owner has an overall complexity of 165 which is very high. The configured complexity threshold is 50. Open
class Owner
{
/**
* Module name or false.
*
- Exclude checks
Owner
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Owner
{
/**
* Module name or false.
*
Method getQueryInitUsers
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
{
$entityData = \App\Module::getEntityInfo('Users');
$selectFields = array_unique(array_merge($entityData['fieldnameArr'], ['id' => 'id', 'is_admin', 'cal_color', 'status']));
// Including deleted vtiger_users for now.
Function getLabel
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function getLabel($mixedId)
{
$multiMode = \is_array($mixedId);
$ids = $multiMode ? $mixedId : [$mixedId];
$missing = [];
- 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
Function getAllocation
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getAllocation($mode, $private, $fieldType)
{
$moduleName = false;
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
$moduleName = $this->moduleName;
- 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 transferOwnershipForWorkflow
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function transferOwnershipForWorkflow($oldId, $newId)
{
$db = \App\Db::getInstance();
$ownerName = static::getLabel($oldId);
$newOwnerName = static::getLabel($newId);
Function getQueryInitUsers
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
{
$entityData = \App\Module::getEntityInfo('Users');
$selectFields = array_unique(array_merge($entityData['fieldnameArr'], ['id' => 'id', 'is_admin', 'cal_color', 'status']));
// Including deleted vtiger_users for now.
- 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 getUsersAndGroupForModuleList
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_user_id')
{
$queryGenerator = new \App\QueryGenerator($this->moduleName, $this->currentUser->getId());
if ($view) {
$queryGenerator->initForCustomViewById($view);
Method getGroups
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGroups($addBlank = true, $private = '')
{
\App\Log::trace("Entering getGroups($addBlank,$private) method ...");
$moduleName = '';
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
Function initUsers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function &initUsers($status = 'Active', $assignedUser = '', $private = '', $roles = false)
{
$cacheKeyMod = 'private' === $private ? $this->moduleName : '';
$cacheKeyAss = \is_array($assignedUser) ? md5(json_encode($assignedUser)) : $assignedUser;
$cacheKeyRole = \is_array($roles) ? md5(json_encode($roles)) : $roles;
- 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
Function getGroups
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getGroups($addBlank = true, $private = '')
{
\App\Log::trace("Entering getGroups($addBlank,$private) method ...");
$moduleName = '';
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- 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 initUsers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function &initUsers($status = 'Active', $assignedUser = '', $private = '', $roles = false)
{
$cacheKeyMod = 'private' === $private ? $this->moduleName : '';
$cacheKeyAss = \is_array($assignedUser) ? md5(json_encode($assignedUser)) : $assignedUser;
$cacheKeyRole = \is_array($roles) ? md5(json_encode($roles)) : $roles;
Method getLabel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getLabel($mixedId)
{
$multiMode = \is_array($mixedId);
$ids = $multiMode ? $mixedId : [$mixedId];
$missing = [];
Function getUserLabel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getUserLabel($id)
{
if (isset(self::$userLabelCache[$id])) {
return self::$userLabelCache[$id];
}
- 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
Function getAccessibleGroups
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getAccessibleGroups($private = '', $fieldType = false, $translate = false)
{
$cacheKey = $private . $this->moduleName . $fieldType . $this->currentUser->getRole();
if (!\App\Cache::has('getAccessibleGroups', $cacheKey)) {
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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 transferOwnership
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function transferOwnership($oldId, $newId)
{
$db = \App\Db::getInstance();
//Updating the smcreatorid,smownerid, modifiedby, smcreatorid in vtiger_crmentity
$db->createCommand()->update('vtiger_crmentity', ['smcreatorid' => $newId], ['smcreatorid' => $oldId, 'setype' => 'ModComments'])->execute();
Function getInstance
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getInstance($moduleName = false, $currentUser = false)
{
if ($currentUser && $currentUser instanceof \Users) {
$currentUser = \App\User::getUserModel($currentUser->id);
} elseif (false === $currentUser) {
- 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
Function getAccessibleUsers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getAccessibleUsers($private = '', $fieldType = false)
{
$cacheKey = $private . $this->moduleName . $fieldType . $this->currentUser->getRole();
if (!\App\Cache::has('getAccessibleUsers', $cacheKey)) {
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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 getUsers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
Function transferOwnership
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function transferOwnership($oldId, $newId)
{
$db = \App\Db::getInstance();
//Updating the smcreatorid,smownerid, modifiedby, smcreatorid in vtiger_crmentity
$db->createCommand()->update('vtiger_crmentity', ['smcreatorid' => $newId], ['smcreatorid' => $oldId, 'setype' => 'ModComments'])->execute();
- 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
Function getUsers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
{
\App\Log::trace("Entering getUsers($addBlank,$status,$private) method ...");
$tempResult = $this->initUsers($status, $assignedUser, $private, $roles);
- 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
Function getAccessibleUsersForModule
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAccessibleUsersForModule()
{
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
if ($this->currentUser->isAdmin() || $curentUserPrivileges->hasGlobalWritePermission()) {
$users = $this->getAccessibleUsers('');
- 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
Function getAccessibleGroupForModule
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAccessibleGroupForModule()
{
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
if ($this->currentUser->isAdmin() || $curentUserPrivileges->hasGlobalWritePermission()) {
$groups = $this->getAccessibleGroups('');
- 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
Function changeFavorites
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function changeFavorites(string $ownerFieldType, int $ownerId): bool
{
$userId = $this->currentUser->getId();
$tabId = \App\Module::getModuleId($this->moduleName);
$dbCommand = \App\Db::getInstance()->createCommand();
- 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
The method getGroups() has an NPath complexity of 360. The configured NPath complexity threshold is 200. Open
public function getGroups($addBlank = true, $private = '')
{
\App\Log::trace("Entering getGroups($addBlank,$private) method ...");
$moduleName = '';
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getLabel() has an NPath complexity of 336. The configured NPath complexity threshold is 200. Open
public static function getLabel($mixedId)
{
$multiMode = \is_array($mixedId);
$ids = $multiMode ? $mixedId : [$mixedId];
$missing = [];
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getUsersAndGroupForModuleList() has an NPath complexity of 448. The configured NPath complexity threshold is 200. Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_user_id')
{
$queryGenerator = new \App\QueryGenerator($this->moduleName, $this->currentUser->getId());
if ($view) {
$queryGenerator->initForCustomViewById($view);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getGroups() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getGroups($addBlank = true, $private = '')
{
\App\Log::trace("Entering getGroups($addBlank,$private) method ...");
$moduleName = '';
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getUsersAndGroupForModuleList() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_user_id')
{
$queryGenerator = new \App\QueryGenerator($this->moduleName, $this->currentUser->getId());
if ($view) {
$queryGenerator->initForCustomViewById($view);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getQueryInitUsers() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
{
$entityData = \App\Module::getEntityInfo('Users');
$selectFields = array_unique(array_merge($entityData['fieldnameArr'], ['id' => 'id', 'is_admin', 'cal_color', 'status']));
// Including deleted vtiger_users for now.
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method transferOwnershipForWorkflow() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
private static function transferOwnershipForWorkflow($oldId, $newId)
{
$db = \App\Db::getInstance();
$ownerName = static::getLabel($oldId);
$newOwnerName = static::getLabel($newId);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getLabel() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public static function getLabel($mixedId)
{
$multiMode = \is_array($mixedId);
$ids = $multiMode ? $mixedId : [$mixedId];
$missing = [];
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method initUsers() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function &initUsers($status = 'Active', $assignedUser = '', $private = '', $roles = false)
{
$cacheKeyMod = 'private' === $private ? $this->moduleName : '';
$cacheKeyAss = \is_array($assignedUser) ? md5(json_encode($assignedUser)) : $assignedUser;
$cacheKeyRole = \is_array($roles) ? md5(json_encode($roles)) : $roles;
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The class Owner has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13. Open
class Owner
{
/**
* Module name or false.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
The method getAccessibleGroups has a boolean flag argument $fieldType, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAccessibleGroups($private = '', $fieldType = false, $translate = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getAccessibleUsers has a boolean flag argument $fieldType, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAccessibleUsers($private = '', $fieldType = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getInstance has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getInstance($moduleName = false, $currentUser = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getInstance has a boolean flag argument $currentUser, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getInstance($moduleName = false, $currentUser = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getAccessibleGroups has a boolean flag argument $translate, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAccessibleGroups($private = '', $fieldType = false, $translate = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '277', column '18'). Open
$query = (new \App\Db\Query())->select($selectFields)->from('vtiger_users')->where($whereSection);
- 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 '799', column '22'). Open
$dataReader = (new \App\Db\Query())->select(['tabid', 'fieldname', 'tablename', 'columnname'])
- 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 getUsersAndGroupForModuleList has a boolean flag argument $conditions, which is a certain sign of a Single Responsibility Principle violation. Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_user_id')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '837', column '22'). Open
$dataReader = (new \App\Db\Query())->select(['task', 'task_id', 'workflow_id'])->from('com_vtiger_workflowtasks')
- 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 getQueryInitUsers has a boolean flag argument $roles, which is a certain sign of a Single Responsibility Principle violation. Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getUsers has a boolean flag argument $onlyAdmin, which is a certain sign of a Single Responsibility Principle violation. Open
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '461', column '25'). Open
$queryGenerator = new \App\QueryGenerator($this->moduleName, $this->currentUser->getId());
- 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 getGroups has a boolean flag argument $addBlank, which is a certain sign of a Single Responsibility Principle violation. Open
public function getGroups($addBlank = true, $private = '')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '283', column '18'). Open
$query = (new \App\Db\Query())->select($selectFields)->from('vtiger_users')->innerJoin('vtiger_user2role', 'vtiger_users.id = vtiger_user2role.userid');
- 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 '712', column '15'). Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');
- 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 getAccessible has a boolean flag argument $fieldType, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAccessible($private = '', $fieldType = false, $translate = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getQueryInitUsers has a boolean flag argument $status, which is a certain sign of a Single Responsibility Principle violation. Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getUsers has a boolean flag argument $roles, which is a certain sign of a Single Responsibility Principle violation. Open
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '370', column '17'). Open
$query = (new \App\Db\Query())->select(['groupid', 'groupname'])->from('vtiger_groups');
- 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 '715', column '14'). Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');
- 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 getUsers has a boolean flag argument $addBlank, which is a certain sign of a Single Responsibility Principle violation. Open
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getQueryInitUsers has a boolean flag argument $private, which is a certain sign of a Single Responsibility Principle violation. Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '262', column '19'). Open
['id' => (new \App\Db\Query())
- 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 '680', column '59'). Open
\App\Cache::save('getFavoriteOwners', $cacheName, (new \App\Db\Query())->select(['ownerid', 'owner' => 'ownerid'])
- 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 getUsersAndGroupForModuleList has a boolean flag argument $view, which is a certain sign of a Single Responsibility Principle violation. Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_user_id')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getAccessible has a boolean flag argument $translate, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAccessible($private = '', $fieldType = false, $translate = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '372', column '21'). Open
$subQuery = (new \App\Db\Query())->select(['groupid'])->from('vtiger_group2modules')->where(['tabid' => $tabId]);
- 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 initUsers has a boolean flag argument $roles, which is a certain sign of a Single Responsibility Principle violation. Open
public function &initUsers($status = 'Active', $assignedUser = '', $private = '', $roles = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '271', column '19'). Open
'id' => (new \App\Db\Query())
- 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 '290', column '17'). Open
$query = new \App\Db\Query();
- 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 '382', column '24'). Open
$unionQuery = (new \App\Db\Query())->select(['sharedgroupid as groupid', 'vtiger_groups.groupname as groupname'])
- 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
Avoid using static access to class '\App\User' in method 'getInstance'. Open
$currentUser = \App\User::getUserModel($currentUser->getId());
- 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 '\Settings_Roles_Record_Model' in method 'getAccessibleGroups'. Open
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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_Cache' in method 'getInstance'. Open
$instance = \Vtiger_Cache::get('App\Fields\Owner', $cacheKey);
- 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\Cache' in method 'getAccessibleGroups'. Open
if (!\App\Cache::has('getAccessibleGroups', $cacheKey)) {
- 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 'getInstance'. Open
$currentUser = \App\User::getCurrentUserModel();
- 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 'getInstance'. Open
$currentUser = \App\User::getUserModel($currentUser);
- 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_Cache' in method 'getInstance'. Open
\Vtiger_Cache::set('App\Fields\Owner', $cacheKey, $instance);
- 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\Config' in method 'getInstance'. Open
$instance->showRoleName = \App\Config::module('Users', 'SHOW_ROLE_NAME');
- 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\Cache' in method 'getAccessibleGroups'. Open
$accessibleGroups = \App\Cache::get('getAccessibleGroups', $cacheKey);
- 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 getAccessibleGroups uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$accessibleGroups = $this->getGroups(false, $private);
}
- 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\Language' in method 'getAccessibleGroups'. Open
$name = \App\Language::translate($name);
- 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\Cache' in method 'getAccessibleGroups'. Open
\App\Cache::save('getAccessibleGroups', $cacheKey, $accessibleGroups);
- 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 'getInstance'. Open
$currentUser = \App\User::getUserModel($currentUser->id);
- 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 getAccessibleGroups uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$accessibleGroups = \App\Cache::get('getAccessibleGroups', $cacheKey);
}
- 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\PrivilegeUtil' in method 'getAccessibleUsers'. Open
$childrenRoles = \App\PrivilegeUtil::getRoleSubordinates($this->currentUser->getRole());
- 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 initUsers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$entityData = \App\Module::getEntityInfo('Users');
$query = $this->getQueryInitUsers($private, $status, $roles);
if (!empty($assignedUser)) {
$query->andWhere(['vtiger_users.id' => $assignedUser]);
- 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\Log' in method 'getUsers'. Open
\App\Log::trace('Exiting getUsers method ...');
- 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\Request' in method 'getGroups'. Open
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- 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 '\Settings_SharingAccess_Module_Model' in method 'getAccessibleUsersForModule'. Open
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
- 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\PrivilegeFile' in method 'getUserLabel'. Open
$users = \App\PrivilegeFile::getUser('id');
- 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 getAccessibleGroupForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$groups = $this->getAccessibleGroups('');
}
- 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 assigning values to variables in if clauses and the like (line '655', column '8'). Open
public static function getUserLabel($id)
{
if (isset(self::$userLabelCache[$id])) {
return self::$userLabelCache[$id];
}
- 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\Cache' in method 'getFavorites'. Open
\App\Cache::save('getFavoriteOwners', $cacheName, (new \App\Db\Query())->select(['ownerid', 'owner' => 'ownerid'])
->from($tableName)
->where(['tabid' => $tabId, 'userid' => $userId])->createCommand()->queryAllByGroup());
- 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\Module' in method 'getQueryInitUsers'. Open
$where[] = ['like', \App\Module::getSqlForNameInDisplayFormat('Users'), $this->searchValue];
- 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\Module' in method 'getGroups'. Open
$tabId = \App\Module::getModuleId($moduleName);
- 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 getAccessibleUsersForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$users = $this->getAccessibleUsers('');
}
- 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\User' in method 'getUsersAndGroupForModuleList'. Open
$userModel = \App\User::getUserModel($id);
- 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\Cache' in method 'getFavorites'. Open
return \App\Cache::get('getFavoriteOwners', $cacheName);
- 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\Json' in method 'transferOwnershipForWorkflow'. Open
$updatedTask = \App\Json::encode($fieldMapping);
- 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\Cache' in method 'getAccessibleUsers'. Open
if (!\App\Cache::has('getAccessibleUsers', $cacheKey)) {
- 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 '\Settings_Roles_Record_Model' in method 'getAccessibleUsers'. Open
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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\Module' in method 'changeFavorites'. Open
$tabId = \App\Module::getModuleId($this->moduleName);
- 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\Cache' in method 'getAccessibleUsers'. Open
return \App\Cache::get('getAccessibleUsers', $cacheKey);
- 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\Cache' in method 'getGroups'. Open
if (\App\Cache::has('OwnerGroups', $cacheKey)) {
- 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 'getUsersAndGroupForModuleList'. Open
$roleName = \App\Language::translate($userModel->getRoleInstance()->getName());
- 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 getLabel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$result[$id] = null;
}
- 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\Json' in method 'transferOwnershipForWorkflow'. Open
$fieldMapping = \App\Json::decode($unserializeTask->field_value_mapping);
- 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 'getGroups'. Open
\App\Log::trace("Entering getGroups($addBlank,$private) method ...");
- 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 getUsersAndGroupForModuleList uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$queryGenerator->setFields([$fieldName]);
}
- 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\Config' in method 'getUsersAndGroupForModuleList'. Open
$adminInList = \App\Config::performance('SHOW_ADMINISTRATORS_IN_USERS_LIST');
- 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 changeFavorites uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$result = $dbCommand->insert($tableName, ['tabid' => $tabId, 'userid' => $userId, 'ownerid' => $ownerId])->execute();
}
- 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\Purifier' in method 'initUsers'. Open
$row[$field] = \App\Purifier::encodeHtml($row[$field]);
- 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\Config' in method 'getUsersIds'. Open
if (\App\Config::performance('ENABLE_CACHING_USERS')) {
- 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 transferOwnership uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$db->createCommand()->update($row['tablename'], [$row['columnname'] => $newId], [$row['columnname'] => $oldId])
->execute();
}
- 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 '\Settings_RecordAllocation_Module_Model' in method 'getAllocation'. Open
$usersGroups = \Settings_RecordAllocation_Module_Model::getRecordAllocationByModule($fieldType, $moduleName);
- 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\Cache' in method 'initUsers'. Open
if (\App\Cache::has('getUsers', $cacheKey)) {
- 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\Module' in method 'getQueryInitUsers'. Open
$entityData = \App\Module::getEntityInfo('Users');
- 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 'getUsers'. Open
\App\Log::trace("Entering getUsers($addBlank,$status,$private) method ...");
- 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 '\Users_Privileges_Model' in method 'getAccessibleUsersForModule'. Open
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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 'getUserLabel'. Open
if ($users = \App\User::getAllLabels()) {
- 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\Module' in method 'getFavorites'. Open
$tabId = \App\Module::getModuleId($this->moduleName);
- 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\PrivilegeFile' in method 'getType'. Open
$users = \App\PrivilegeFile::getUser('id');
- 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\Cache' in method 'initUsers'. Open
$tempResult = \App\Cache::get('getUsers', $cacheKey);
- 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\Cache' in method 'initUsers'. Open
\App\Cache::save('getUsers', $cacheKey, $tempResult);
- 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 '\Users_Privileges_Model' in method 'getAccessibleGroupForModule'. Open
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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 getAccessibleUsersForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
if ($sharingAccessModel && $sharingAccessModel->isPrivate()) {
$users = $this->getAccessibleUsers('private');
} else {
- 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 '\Settings_Roles_Record_Model' in method 'getAccessibleUsers'. Open
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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\Cache' in method 'getAccessibleUsers'. Open
\App\Cache::save('getAccessibleUsers', $cacheKey, $accessibleUser);
- 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 'getQueryInitUsers'. Open
$userPrivileges = \App\User::getPrivilegesFile($this->currentUser->getId());
- 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 'getQueryInitUsers'. Open
\App\Log::trace('Sharing is Public. All vtiger_users should be listed');
- 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 'getGroups'. Open
\App\Log::trace('Exiting getGroups method ...');
- 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 getColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
static::$colorsCache = [];
}
- 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\Config' in method 'getUsers'. Open
$adminInList = \App\Config::performance('SHOW_ADMINISTRATORS_IN_USERS_LIST');
- 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\PrivilegeFile' in method 'getUsersIds'. Open
$rows = \App\PrivilegeFile::getUser('id');
- 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\Cache' in method 'changeFavorites'. Open
\App\Cache::delete('getFavoriteOwners', "{$tabId}:{$userId}:{$ownerFieldType}");
- 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\Db' in method 'transferOwnershipForWorkflow'. Open
$db = \App\Db::getInstance();
- 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\PrivilegeUtil' in method 'getAccessibleUsers'. Open
$childrenRoles = \App\PrivilegeUtil::getRoleSubordinates($this->currentUser->getRole());
- 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 'initUsers'. Open
$roleName = \App\Language::translate($row['rolename'], '_Base', false, true);
- 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 getQueryInitUsers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\App\Log::trace('Sharing is Public. All vtiger_users should be listed');
$query = new \App\Db\Query();
$query->select($selectFields)->from('vtiger_users');
if ($this->showRoleName) {
- 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 getUsersIds uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$instance = new self();
$rows = $instance->initUsers($status);
}
- 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 getAllocation uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$groups = $usersGroups['groups'] ?? [];
if (!empty($groups)) {
$groupsAll = $this->getGroups(false, $private);
foreach ($groupsAll as $ID => $name) {
- 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\Cache' in method 'getGroups'. Open
return \App\Cache::get('OwnerGroups', $cacheKey);
- 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\Cache' in method 'getGroups'. Open
\App\Cache::save('OwnerGroups', $cacheKey, $tempResult);
- 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\Config' in method 'getUserLabel'. Open
if (\App\Config::performance('ENABLE_CACHING_USERS')) {
- 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 transferOwnershipForWorkflow uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
//For VTCreateTodoTask and VTCreateEventTask
if (isset($unserializeTask->assigned_user_id)) {
$value = $unserializeTask->assigned_user_id;
if ($value == $oldId) {
- 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\Module' in method 'initUsers'. Open
$entityData = \App\Module::getEntityInfo('Users');
- 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\Module' in method 'getQueryInitUsers'. Open
->where(['vtiger_tmp_write_user_sharing_per.userid' => $this->currentUser->getId(), 'vtiger_tmp_write_user_sharing_per.tabid' => \App\Module::getModuleId($this->moduleName)]),
- 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 getAccessibleUsers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$accessibleUser[$this->currentUser->getId()] = $this->currentUser->getName();
}
- 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\Request' in method 'getAllocation'. Open
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- 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 'getQueryInitUsers'. Open
\App\Log::trace('Sharing is Private. Only the current user should be listed');
- 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 'getGroups'. Open
\App\Log::trace('Sharing is Public. All vtiger_users should be listed');
- 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 getAccessibleGroupForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
if ($sharingAccessModel && $sharingAccessModel->isPrivate()) {
$groups = $this->getAccessibleGroups('private');
} else {
- 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 '\Settings_SharingAccess_Module_Model' in method 'getAccessibleGroupForModule'. Open
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
- 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 getUserLabel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($users = \App\User::getAllLabels()) {
foreach ($users as $uid => &$user) {
self::$userLabelCache[$uid] = $user;
self::$ownerLabelCache[$uid] = $user;
- 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\Purifier' in method 'initUsers'. Open
$row['rolename'] = \App\Purifier::encodeHtml($row['rolename']);
- 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\Cache' in method 'getFavorites'. Open
if (!\App\Cache::has('getFavoriteOwners', $cacheName)) {
- 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\Config' in method 'getType'. Open
if (\App\Config::performance('ENABLE_CACHING_USERS')) {
- 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 getType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$isExists = !empty(self::getUserLabel($id));
}
- 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\Db' in method 'transferOwnership'. Open
$db = \App\Db::getInstance();
- 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
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
Open
$accessibleGroups = array_filter($accessibleGroups, fn ($name) => strstr(strtolower($name), $this->searchValue));
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function getAccessibleUsersForModule()
{
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
if ($this->currentUser->isAdmin() || $curentUserPrivileges->hasGlobalWritePermission()) {
$users = $this->getAccessibleUsers('');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 119.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function getAccessibleGroupForModule()
{
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
if ($this->currentUser->isAdmin() || $curentUserPrivileges->hasGlobalWritePermission()) {
$groups = $this->getAccessibleGroups('');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 119.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $classNameWithDoubleQuotes. Keep variable name length under 20. Open
$classNameWithDoubleQuotes = $taskComponents[2];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = false;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getUserLabel($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getGroupName($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getType($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getColor($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The 'getType()' method which returns a boolean should be named 'is...()' or 'has...()' Open
public static function getType($id)
{
if (isset(self::$typeCache[$id])) {
return self::$typeCache[$id];
}
- Read upRead up
- Exclude checks
BooleanGetMethodName
Since: 0.2
Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.
Example
class Foo {
/**
* @return boolean
*/
public function getFoo() {} // bad
/**
* @return bool
*/
public function isFoo(); // ok
/**
* @return boolean
*/
public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}
Source https://phpmd.org/rules/naming.html#booleangetmethodname
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool|string
- 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
* Show role name.
- 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
* Module name or false.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $searchValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $moduleName = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $currentUser;
- 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
} elseif (\is_object($currentUser) && 'Users_Record_Model' === \get_class($currentUser)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->moduleName = $moduleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Vtiger_Cache::set('App\Fields\Owner', $cacheKey, $instance);
- 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
$name = \App\Language::translate($name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->searchValue = strtolower($this->searchValue);
- 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
* @param string $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $fieldType
- 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = false;
- 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
* Function to get the instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = \App\User::getUserModel($currentUser->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Cache::has('getAccessibleGroups', $cacheKey)) {
- 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
* @param string $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usersGroups = \Settings_RecordAllocation_Module_Model::getRecordAllocationByModule($fieldType, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$usersGroups = $usersGroups[$this->currentUser->getId()] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users = $usersGroups['users'] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->searchValue = $value;
- 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
$accessibleGroups = \App\Cache::get('getAccessibleGroups', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleUser = $this->getUsers(false, 'Active', '', '', false, array_unique($childrenRoles));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleUser[$this->currentUser->getId()] = $this->currentUser->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $translate
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAccessible($private = '', $fieldType = false, $translate = false)
- 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
* @return \self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = $moduleName . $currentUser->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAccessibleGroups($private = '', $fieldType = false, $translate = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = $private . $this->moduleName . $fieldType . $this->currentUser->getRole();
- 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
} elseif (3 === $assignTypeValue) {
- 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
$currentUser = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $translate
- 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
$roles = array_merge($sameLevelRoles, $childrenRoles);
- 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
$currentUser = \App\User::getUserModel($currentUser->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleName) {
- 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
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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 static function getInstance($moduleName = false, $currentUser = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (is_numeric($currentUser)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->currentUser = $currentUser;
- 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 find($value)
- 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 (!empty($fieldType) && (5 === (int) $currentUserRoleModel->get('sharedOwner' === $fieldType ? 'assignedmultiowner' : 'allowassignedrecordsto')) && 'Public' !== $private) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleGroups = array_filter($accessibleGroups, fn ($name) => strstr(strtolower($name), $this->searchValue));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get all the accessible users.
- 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 mixed $fieldType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sameLevelRoles = array_keys($currentUserRoleModel->getSameLevelRoles());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [
- 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 (!empty($users)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (false === $currentUser) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($accessibleGroups as &$name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (2 === $assignTypeValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!empty($fieldType) && 5 === $assignTypeValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'groups' => $this->getAccessibleGroups($private, $fieldType, $translate),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = \Vtiger_Cache::get('App\Fields\Owner', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->showRoleName = \App\Config::module('Users', 'SHOW_ROLE_NAME');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $fieldType
- 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
$accessibleGroups = $this->getAllocation('groups', $private, $fieldType);
- 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
$assignTypeValue = (int) $currentUserRoleModel->get('sharedOwner' === $fieldType ? 'assignedmultiowner' : 'allowassignedrecordsto');
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
$assignTypeValue = (int) $currentUserRoleModel->get('sharedOwner' === $fieldType ? 'assignedmultiowner' : 'allowassignedrecordsto');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childrenRoles = \App\PrivilegeUtil::getRoleSubordinates($this->currentUser->getRole());
- 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
\App\Cache::save('getAccessibleUsers', $cacheKey, $accessibleUser);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::get('getAccessibleUsers', $cacheKey);
- 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 getAllocation($mode, $private, $fieldType)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('users' == $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $instance) {
- 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
$accessibleUser = $this->getAllocation('users', '', $fieldType);
- 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
$moduleName = $this->moduleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $currentUser
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
if (!empty($fieldType) && (5 === (int) $currentUserRoleModel->get('sharedOwner' === $fieldType ? 'assignedmultiowner' : 'allowassignedrecordsto')) && 'Public' !== $private) {
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleUser[$this->currentUser->getId()] = $this->currentUser->getName();
- 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 string $fieldType
- 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 $showRoleName = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = \App\User::getUserModel($currentUser);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get all the accessible groups.
- 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
$accessibleGroups = $this->getGroups(false, $private);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('getAccessibleGroups', $cacheKey, $accessibleGroups);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$accessibleGroups = array_filter($accessibleGroups, fn ($name) => strstr(strtolower($name), $this->searchValue));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Cache::has('getAccessibleUsers', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === $assignTypeValue || 'Public' === $private) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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
'users' => $this->getAccessibleUsers($private, $fieldType),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $mode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $accessibleGroups;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAccessibleUsers($private = '', $fieldType = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleUser = $this->getUsers(false, 'Active', '', 'Public', true);
- 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 ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- 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 ($translate) {
- 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
$cacheKey = $private . $this->moduleName . $fieldType . $this->currentUser->getRole();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleUser = $this->getUsers(false, 'Active', '', '', false, array_unique($roles));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childrenRoles = \App\PrivilegeUtil::getRoleSubordinates($this->currentUser->getRole());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get accessible.
- 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 allocation.
- 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 ($currentUser && $currentUser instanceof \Users) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->searchValue)) {
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $result;
- 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
$tempResult = [];
- 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 mixed $roles
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$selectFields = array_unique(array_merge($entityData['fieldnameArr'], ['id' => 'id', 'is_admin', 'cal_color', 'status']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['id' => $this->currentUser->getId()],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_tmp_write_user_sharing_per.userid' => $this->currentUser->getId(), 'vtiger_tmp_write_user_sharing_per.tabid' => \App\Module::getModuleId($this->moduleName)]),
- 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
$groups = $usersGroups['groups'] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($ID, $groups)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fullName .= " ({$roleName})";
- 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
->select(['vtiger_user2role.userid'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_role', 'vtiger_user2role.roleid = vtiger_role.roleid')
- 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
* @param string $status User status
- 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
$query->andWhere(['vtiger_users.id' => $assignedUser]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $tempResult;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function gets sql query.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$whereSection = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'or',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function initiates users list.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['like', 'parentrole', $userPrivileges['_privileges']['parent_role_seq'] . '::%', false]),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKeyMod = 'private' === $private ? $this->moduleName : '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => (new \App\Db\Query())
- 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 ($this->showRoleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fullName .= ' ' . $row[$field];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_role', 'vtiger_user2role.roleid = vtiger_role.roleid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Sharing is Private. Only the current user should be listed');
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$query->addSelect(['rolename'])->innerJoin('vtiger_role', 'vtiger_user2role.roleid = vtiger_role.roleid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$whereSection[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->searchValue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(array_merge(['and'], $where));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $query;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($groupsAll as $ID => $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityData = \App\Module::getEntityInfo('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$query->addSelect(['vtiger_role.rolename'])->innerJoin('vtiger_user2role', 'vtiger_user2role.userid = vtiger_users.id')
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$query = (new \App\Db\Query())->select($selectFields)->from('vtiger_users')->innerJoin('vtiger_user2role', 'vtiger_users.id = vtiger_user2role.userid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($where) {
- 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 &initUsers($status = 'Active', $assignedUser = '', $private = '', $roles = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($entityData['fieldnameArr'] as &$field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempResult[$row['id']] = $row;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getQueryInitUsers($private = false, $status = false, $roles = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityData = \App\Module::getEntityInfo('Users');
- 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 (\App\Cache::has('getUsers', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($assignedUser)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row[$field] = \App\Purifier::encodeHtml($row[$field]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $status
- 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
* @param mixed $assignedUser
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Get the id and the name.
- 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
->from('vtiger_tmp_write_user_sharing_per')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (false !== $roles) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->showRoleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = new \App\Db\Query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->select($selectFields)->from('vtiger_users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where[] = ['like', \App\Module::getSqlForNameInDisplayFormat('Users'), $this->searchValue];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($status) {
- 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
$result = $this->getUsers(false, 'Active', $users);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['rolename'] = \App\Purifier::encodeHtml($row['rolename']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('getUsers', $cacheKey, $tempResult);
- 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
// Including deleted vtiger_users for now.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->addSelect(['vtiger_role.rolename'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $onlyAdmin Show only admin users
- 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
$cacheKeyAss = \is_array($assignedUser) ? md5(json_encode($assignedUser)) : $assignedUser;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempResult = \App\Cache::get('getUsers', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $this->getQueryInitUsers($private, $status, $roles);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->showRoleName && isset($row['rolename'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roleName = \App\Language::translate($row['rolename'], '_Base', false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('private' === $private) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->addSelect(['rolename'])->innerJoin('vtiger_role', 'vtiger_user2role.roleid = vtiger_role.roleid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where[] = ['status' => $status];
- 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
$cacheKeyRole = \is_array($roles) ? md5(json_encode($roles)) : $roles;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Line exceeds 120 characters; contains 199 characters Open
->where(['vtiger_tmp_write_user_sharing_per.userid' => $this->currentUser->getId(), 'vtiger_tmp_write_user_sharing_per.tabid' => \App\Module::getModuleId($this->moduleName)]),
- 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
* @param string|array|int $assignedUser User id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($groups)) {
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$cacheKey = $cacheKeyMod . '_' . $status . '|' . $cacheKeyAss . '_' . $private . '|' . $cacheKeyRole . '_' . (int) $this->showRoleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fullName = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \App\Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->moduleName) {
- 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
->innerJoin('vtiger_role', 'vtiger_user2role.roleid = vtiger_role.roleid');
- 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 string $private Sharing type
- 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
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $status
- 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
$query = (new \App\Db\Query())->select($selectFields)->from('vtiger_users')->innerJoin('vtiger_user2role', 'vtiger_users.id = vtiger_user2role.userid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where[] = ['vtiger_user2role.roleid' => $roles];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $roles
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['fullName'] = trim($fullName);
- 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
['id' => (new \App\Db\Query())
- 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
$query = (new \App\Db\Query())->select($selectFields)->from('vtiger_users')->where($whereSection);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->showRoleName) {
- 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
$cacheKey = $cacheKeyMod . '_' . $status . '|' . $cacheKeyAss . '_' . $private . '|' . $cacheKeyRole . '_' . (int) $this->showRoleName;
- 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
->from('vtiger_user2role')
- 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\Log::trace('Sharing is Public. All vtiger_users should be listed');
- 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
* Function returns the user key in user 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
\App\Log::trace("Entering getUsers($addBlank,$status,$private) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupsAll = $this->getGroups(false, $private);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result[$ID] = $name;
- 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
$selectFields = array_unique(array_merge($entityData['fieldnameArr'], ['id' => 'id', 'is_admin', 'cal_color', 'status']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userPrivileges = \App\User::getPrivilegesFile($this->currentUser->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['vtiger_tmp_write_user_sharing_per.shareduserid'])
- 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
$query->addSelect(['vtiger_role.rolename'])->innerJoin('vtiger_user2role', 'vtiger_user2role.userid = vtiger_users.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_user2role', 'vtiger_user2role.userid = vtiger_users.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $addBlank
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $roles
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
public function getUsers($addBlank = false, $status = 'Active', $assignedUser = '', $private = '', $onlyAdmin = false, $roles = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Add in a blank row
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->moduleName;
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$subQuery = (new \App\Db\Query())->select(['groupid'])->from('vtiger_group2modules')->where(['tabid' => $tabId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['vtiger_tmp_write_group_sharing_per.tabid' => $tabId]);
- 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
* Function returns list of accessible users for a module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAccessibleGroupForModule()
- 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
$adminInList = \App\Config::performance('SHOW_ADMINISTRATORS_IN_USERS_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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::get('OwnerGroups', $cacheKey);
- 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
// Including deleted vtiger_users for now.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleName && 'CustomView' !== $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_tmp_write_group_sharing_per')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->union($unionQuery);
- 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
$query->orderBy(['groupname' => SORT_ASC]);
- 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
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users = $this->getAccessibleUsers('private');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempResult = $this->initUsers($status, $assignedUser, $private, $roles);
- 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
* Function to get groups.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sharingAccessModel && $sharingAccessModel->isPrivate()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get users and group for module list.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getUsersAndGroupForModuleList($view = false, $conditions = false, $fieldName = 'assigned_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
if (true === $addBlank) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
asort($users);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->currentUser->getGroups()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('OwnerGroups', $cacheKey, $tempResult);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users = $this->getAccessibleUsers('');
- 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 ($conditions['join'] as $join) {
- 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$unionQuery = (new \App\Db\Query())->select(['sharedgroupid as groupid', 'vtiger_groups.groupname as groupname'])
- 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 $groups;
- 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
$users[$key] = $row['fullName'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getGroups($addBlank = true, $private = '')
- 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
$cacheKey = $addBlank . $private . $moduleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['groupid' => $this->currentUser->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orWhere(['vtiger_groups.groupid' => $this->currentUser->getGroups()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleName) {
- 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
Spaces must be used to indent lines; tabs are not allowed Open
$users = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $private
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = '';
- 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
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
- 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
$users[''] = '';
- 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 ($this->currentUser->isAdmin() || $curentUserPrivileges->hasGlobalWritePermission()) {
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->clearFields();
- 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
\App\Log::trace("Entering getGroups($addBlank,$private) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting getGroups method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $tempResult;
- 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 string $fieldName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users = $groups = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryField = $queryGenerator->getQueryRelatedField($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isAdmin = $this->currentUser->isAdmin();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $addBlank
- 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
$tabId = \App\Module::getModuleId($moduleName);
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
->innerJoin('vtiger_groups', 'vtiger_tmp_write_group_sharing_per.sharedgroupid = vtiger_groups.groupid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_tmp_write_group_sharing_per.userid' => $this->currentUser->getId()])
- 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
$groups = $this->getAccessibleGroups('');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$curentUserPrivileges = \Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($conditions) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting getUsers method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $users;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempResult[$row['groupid']] = $row['groupname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sharingAccessModel = $this->moduleName ? \Settings_SharingAccess_Module_Model::getInstance($this->moduleName) : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sharingAccessModel && $sharingAccessModel->isPrivate()) {
- 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
public function getAccessibleUsersForModule()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new \App\QueryGenerator($this->moduleName, $this->currentUser->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($view) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addJoin($join);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($tempResult)) {
- 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 (!$onlyAdmin || $isAdmin || !(!$adminInList && 'on' == $row['is_admin'])) {
- 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
$unionQuery = (new \App\Db\Query())->select(['sharedgroupid as groupid', 'vtiger_groups.groupname as groupname'])
- 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
$queryGenerator->addNativeCondition($conditions['condition']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($conditions['join'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has('OwnerGroups', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$subQuery = (new \App\Db\Query())->select(['groupid'])->from('vtiger_group2modules')->where(['tabid' => $tabId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->where(['groupid' => $subQuery]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Add in a blank row
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns list of accessible users for a module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $view
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool|array $conditions
- 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
while ($row = $dataReader->read()) {
- 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 ($this->currentUser->isAdmin() || $curentUserPrivileges->hasGlobalWritePermission()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groups = $this->getAccessibleGroups('');
- 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\Log::trace('Sharing is Public. All vtiger_users should be listed');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->select(['groupid', 'groupname'])->from('vtiger_groups');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('private' === $private) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempResult[''] = '';
- 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
$queryGenerator->initForCustomViewById($view);
- 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 (false !== strpos($fieldName, ':')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tempResult as $key => $row) {
- 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
->innerJoin('vtiger_groups', 'vtiger_tmp_write_group_sharing_per.sharedgroupid = vtiger_groups.groupid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempResult = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (true === $addBlank) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groups = $this->getAccessibleGroups('private');
- 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
$users = $this->getAccessibleUsers('');
- 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 $users;
- 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
$queryGenerator->setFields([])->setCustomColumn($queryField->getColumnName())->addRelatedJoin($queryField->getRelated());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields([$fieldName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['users' => $users, 'group' => $groups];
- 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
$ids = $multiMode ? $mixedId : [$mixedId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($id && !isset(self::$ownerLabelCache[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($missing as $userId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($diffIds) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = $groups[$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$groupIdCache[$label] = $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The function gets the user label.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($ids as $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
$rows = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$usersIdsCache[$status];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$groupLabelCache[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = false;
- 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 int $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
public static function getAllUsers($status = 'Active')
- 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
self::getGroupName($groupId);
- 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
$groups = $instance->getGroups(false);
- 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
$id = self::$groupIdCache[$name] = $groups[$name];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \App\User::getUserModel($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
foreach (array_values($diffIds) as $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
$instance = new self();
- 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 (isset($groups[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($groups[$name])) {
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$queryGenerator->setFields([])->setCustomColumn($queryField->getColumnName())->addRelatedJoin($queryField->getRelated());
- 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
$adminInList = \App\Config::performance('SHOW_ADMINISTRATORS_IN_USERS_LIST');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$diffIds = array_diff($ids, array_keys($users));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The function retrieves all users with active status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance->initUsers($status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset(self::$usersIdsCache[$status])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = $instance->initUsers($status);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$groupLabelCache[$id] = self::$ownerLabelCache[$id] = $label;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- 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 (!empty($name) && ($adminInList || (!$adminInList && !$userModel->isAdmin()))) {
- 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 ($ids as $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getGroupName($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
$instance = new self();
- 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
* Function gets labels.
- 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
foreach ($ids as $id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The function gets the group names.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $label;
- 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 static function getGroupId($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- 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
protected static $groupIdCache = [];
- 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
* Function to get the group id for a given group groupname.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($name)) {
- 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
$diffIds = array_diff($missing, array_keys(self::$ownerLabelCache));
- 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
$result[$id] = null;
- 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 (isset(self::$groupIdCache[$name])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users[$id] = $name;
- 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 (\App\Config::performance('ENABLE_CACHING_USERS')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = \App\PrivilegeFile::getUser('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
$missing = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$missing[] = $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($missing)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($diffIds as $groupId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- 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
$ids = $queryGenerator->createQuery()->distinct()->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = $userModel->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users[$id] .= " ({$roleName})";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- 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
protected static $ownerLabelCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $userLabelCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$multiMode = \is_array($mixedId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
$name = self::getGroupName($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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $groupLabelCache = [];
- 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
$result = [];
- 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
$instance = new self();
- 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
$groups[$id] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $usersIdsCache = [];
- 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 static function getUsersIds($status = 'Active')
- 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
self::getUserLabel($userId);
- 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
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->showRoleName) {
- 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|int $mixedId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array|int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getLabel($mixedId)
- 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 int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$groupIdCache[$name];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($diffIds) {
- 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
* The function retrieves user ids with active status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $status
- 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 $multiMode ? $result : array_shift($result);
- 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
$groups = array_flip($instance->getGroups(false));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roleName = \App\Language::translate($userModel->getRoleInstance()->getName());
- 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 string $status
- 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
self::$usersIdsCache[$status] = array_keys($rows);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$ownerLabelCache[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result[$id] = self::$ownerLabelCache[$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$groupLabelCache[$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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$ownerLabelCache[$uid] = $user['fullName'];
- 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 (!static::$colorsCache) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::performance('ENABLE_CACHING_USERS')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$userLabelCache[$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
$tableName = 'sharedOwner' === $ownerFieldType ? 'u_#__favorite_shared_owners' : 'u_#__favorite_owners';
- 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
$userId = $this->currentUser->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $dbCommand->delete($tableName, ['tabid' => $tabId, 'userid' => $userId, 'ownerid' => $ownerId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$colorsCache = require ROOT_DIRECTORY . '/app_data/owners_colors.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$colorsCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$typeCache[$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Transfer ownership records.
- 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
$userLabel = isset($users[$id]) ? $users[$id]['fullName'] : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userLabel = $users[$id] ?? false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Groups':
- 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
return $result;
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$db->createCommand()->update('vtiger_crmentity', ['smcreatorid' => $newId], ['smcreatorid' => $oldId, 'setype' => 'ModComments'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($users = \App\User::getAllLabels()) {
- 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
\App\Cache::delete('getFavoriteOwners', "{$tabId}:{$userId}:{$ownerFieldType}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get owner color.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $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
if (isset(static::$colorsCache[$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
* @return bool
- 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
* @return bool|string
- 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
$tabId = \App\Module::getModuleId($this->moduleName);
- 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
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($this->getFavorites($ownerFieldType)[$ownerId])) {
- 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
protected static $typeCache = [];
- 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
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Updating the smcreatorid,smownerid, modifiedby, smcreatorid in vtiger_crmentity
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($users as $uid => &$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
\App\Cache::save('getFavoriteOwners', $cacheName, (new \App\Db\Query())->select(['ownerid', 'owner' => 'ownerid'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['tabid' => $tabId, 'userid' => $userId])->createCommand()->queryAllByGroup());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::get('getFavoriteOwners', $cacheName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch (self::getType($ownerId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerList = $this->getAccessibleUsers('', $ownerFieldType);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerList = $this->getAccessibleGroups('', $ownerFieldType);
- 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
$result = $dbCommand->insert($tableName, ['tabid' => $tabId, 'userid' => $userId, 'ownerid' => $ownerId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $colorsCache = false;
- 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 '#' . substr($hash, 0, 2) . substr($hash, 2, 2) . substr($hash, 4, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function checks record type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $isExists ? 'Users' : 'Groups';
- 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
$cacheName = "{$tabId}:{$userId}:{$ownerFieldType}";
- 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 (!isset($ownerList[$ownerId])) {
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$result = $dbCommand->insert($tableName, ['tabid' => $tabId, 'userid' => $userId, 'ownerid' => $ownerId])->execute();
- 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 string $ownerFieldType
- 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
return (bool) $result;
- 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
$isExists = !empty(self::getUserLabel($id));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $newId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$userLabelCache[$uid] = $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFavorites(string $ownerFieldType): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Cache::has('getFavoriteOwners', $cacheName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getUserLabel($id)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $ownerId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$userLabelCache[$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
public function changeFavorites(string $ownerFieldType, int $ownerId): bool
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$result = $dbCommand->delete($tableName, ['tabid' => $tabId, 'userid' => $userId, 'ownerid' => $ownerId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = 'sharedOwner' === $ownerFieldType ? 'u_#__favorite_shared_owners' : 'u_#__favorite_owners';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hash = md5('color' . $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $oldId
- 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 static function transferOwnership($oldId, $newId)
- 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
self::$userLabelCache[$uid] = $user['fullName'];
- 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
* @throws \App\Exceptions\NoPermitted
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $single
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Users':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userLabel = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::performance('ENABLE_CACHING_USERS')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $ownerFieldType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users = \App\PrivilegeFile::getUser('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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (file_exists(ROOT_DIRECTORY . '/app_data/owners_colors.php')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$colorsCache[$id];
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$typeCache[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$typeCache[$id] = $result;
- 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
$users = \App\PrivilegeFile::getUser('id');
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
\App\Cache::save('getFavoriteOwners', $cacheName, (new \App\Db\Query())->select(['ownerid', 'owner' => 'ownerid'])
- 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
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \yii\db\Exception
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- 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
* @var bool|string Owners color
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($users as $uid => $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
self::$ownerLabelCache[$uid] = $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = $this->currentUser->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Change favorite owner state.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getColor($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
*
- 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
$isExists = isset($users[$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
return $userLabel ?? false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets favorite owners.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from($tableName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = \App\Module::getModuleId($this->moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- 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
/**
- 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 static function getType($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
$db->createCommand()->update('vtiger_crmentity', ['smcreatorid' => $newId], ['smcreatorid' => $oldId, 'setype' => 'ModComments'])->execute();
- 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
->from('vtiger_field')
- 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
$taskComponents = explode(':', $task);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition['value'] = $newOwnerName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$column = $row['tablename'] . '.' . $row['columnname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$unserializeTask = unserialize($task);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$serializeTask = serialize($unserializeTask);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->select(['tabid', 'fieldname', 'tablename', 'columnname'])
- 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 = $unserializeTask->assigned_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
$db->createCommand()->update('vtiger_crmentity', ['modifiedby' => $newId], ['modifiedby' => $oldId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_import_maps', ['date_modified' => date('Y-m-d H:i:s'), 'assigned_user_id' => $newId], ['assigned_user_id' => $oldId])->execute();
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$db->createCommand()->update($row['tablename'], [$row['columnname'] => $newId], [$row['columnname'] => $oldId])
- 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
self::transferOwnershipForWorkflow($oldId, $newId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerName = static::getLabel($oldId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$className = str_replace('"', '', $classNameWithDoubleQuotes);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition['value'] = $newId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($unserializeTask->assigned_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
$newOwnerName = static::getLabel($newId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldMapping as $key => $condition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($value == $ownerName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldMapping[$key] = $condition;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//update workflow tasks Assigned User from Deleted User to Transfer User
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldSearchValue = 's:16:"assigned_user_id"';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->select(['task', 'task_id', 'workflow_id'])->from('com_vtiger_workflowtasks')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldMapping = \App\Json::decode($unserializeTask->field_value_mapping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $condition['value'];
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$db->createCommand()->update('com_vtiger_workflowtasks', ['task' => $serializeTask], ['workflow_id' => $row['workflow_id'], 'task_id' => $row['task_id']])->execute();
- 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
$unserializeTask->assigned_user_id = $newId;
- 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
$db->createCommand()->delete('vtiger_users2group', ['userid' => $oldId])->execute();
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
$db->createCommand()->update($row['tablename'], [$row['columnname'] => $newId], ['and', [$row['columnname'] => $oldId], ['<>', 'setype', 'ModComments']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($fieldMapping)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//For VTCreateTodoTask and VTCreateEventTask
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
$db->createCommand()->update('vtiger_import_maps', ['date_modified' => date('Y-m-d H:i:s'), 'assigned_user_id' => $newId], ['assigned_user_id' => $oldId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_fieldmodulerel', 'vtiger_field.fieldid = vtiger_fieldmodulerel.fieldid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnList = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('smcreatorid' === $row['columnname'] || 'smownerid' === $row['columnname']) {
- 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
//updating the vtiger_import_maps
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnList[] = $column;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update($row['tablename'], [$row['columnname'] => $newId], [$row['columnname'] => $oldId])
- 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
$updatedTask = \App\Json::encode($fieldMapping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('com_vtiger_workflowtasks', ['task' => $serializeTask], ['workflow_id' => $row['workflow_id'], 'task_id' => $row['task_id']])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($value == $oldId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_crmentity', ['smownerid' => $newId], ['smownerid' => $oldId, 'setype' => 'ModComments'])->execute();
- 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 type $oldId
- 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
private static function transferOwnershipForWorkflow($oldId, $newId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$idSearchValue = '"fieldname":"assigned_user_id","value":"' . $oldId . '"';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('assigned_user_id' == $condition['fieldname']) {
- 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
if (!\in_array($column, $columnList)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update($row['tablename'], [$row['columnname'] => $newId], ['and', [$row['columnname'] => $oldId], ['<>', 'setype', 'ModComments']])
- 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
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$classNameWithDoubleQuotes = $taskComponents[2];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$unserializeTask->field_value_mapping = $updatedTask;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['or', ['uitype' => [52, 53, 77, 101]], ['uitype' => 10, 'relmodule' => 'Users']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('com_vtiger_workflowtasks', ['task' => $serializeTask], ['workflow_id' => $row['workflow_id'], 'task_id' => $row['task_id']])->execute();
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$db->createCommand()->update('com_vtiger_workflowtasks', ['task' => $serializeTask], ['workflow_id' => $row['workflow_id'], 'task_id' => $row['task_id']])->execute();
- 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 type $newId
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$dataReader = (new \App\Db\Query())->select(['task', 'task_id', 'workflow_id'])->from('com_vtiger_workflowtasks')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/VTTaskManager.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/tasks/' . $className . '.php';
- 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
* Transfer ownership workflow tasks.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task = $row['task'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($unserializeTask->field_value_mapping)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($value) && $value == $oldId) {
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$db->createCommand()->update('vtiger_crmentity', ['smownerid' => $newId], ['smownerid' => $oldId, 'setype' => 'ModComments'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['or like', 'task', [$nameSearchValue, $idSearchValue, $fieldSearchValue]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$serializeTask = serialize($unserializeTask);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nameSearchValue = '"fieldname":"assigned_user_id","value":"' . $ownerName . '"';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$accessibleGroups = array_filter($accessibleGroups, fn ($name) => strstr(strtolower($name), $this->searchValue));
- Exclude checks
The variable $ID is not named in camelCase. Open
public function getAllocation($mode, $private, $fieldType)
{
$moduleName = false;
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
$moduleName = $this->moduleName;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ID is not named in camelCase. Open
public function getAllocation($mode, $private, $fieldType)
{
$moduleName = false;
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
$moduleName = $this->moduleName;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ID is not named in camelCase. Open
public function getAllocation($mode, $private, $fieldType)
{
$moduleName = false;
if ('Settings' !== \App\Request::_get('parent') && $this->moduleName) {
$moduleName = $this->moduleName;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}