Function getHierarchyData
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
{
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
$currentUser = Users_Privileges_Model::getCurrentUserModel();
$hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
- 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 getParent
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0)
{
\App\Log::trace('Entering getParent(' . $id . ') method ...');
if ($depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
\App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
- 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 getChild
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getChild(int $id, array &$childRow, int $depthBase)
{
\App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
if (empty($id) || $depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
\App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
- 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 getParent
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0)
{
\App\Log::trace('Entering getParent(' . $id . ') method ...');
if ($depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
\App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
Method getChild
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getChild(int $id, array &$childRow, int $depthBase)
{
\App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
if (empty($id) || $depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
\App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
Method getHierarchyData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
{
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
$currentUser = Users_Privileges_Model::getCurrentUserModel();
$hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
Method getHierarchyData
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
The method getHierarchyData() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
{
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
$currentUser = Users_Privileges_Model::getCurrentUserModel();
$hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
- 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 getParent() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0)
{
\App\Log::trace('Entering getParent(' . $id . ') method ...');
if ($depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
\App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
- 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
Refactor this function to reduce its Cognitive Complexity from 31 to the 15 allowed. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. Open
public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The method getHierarchy has a boolean flag argument $getRawData, which is a certain sign of a Single Responsibility Principle violation. Open
public function getHierarchy($id, $getRawData = false, $getLinks = true)
- 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 getHierarchyData has a boolean flag argument $getRawData, which is a certain sign of a Single Responsibility Principle violation. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
- 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 setRelationTables has a boolean flag argument $secModule, which is a certain sign of a Single Responsibility Principle violation. Open
public function setRelationTables($secModule = 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 getHierarchyData has a boolean flag argument $getLinks, which is a certain sign of a Single Responsibility Principle violation. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
- 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 getHierarchy has a boolean flag argument $getLinks, which is a certain sign of a Single Responsibility Principle violation. Open
public function getHierarchy($id, $getRawData = false, $getLinks = true)
- 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 '261', column '22'). Open
$dataReader = (new App\Db\Query())->select([
- 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 '201', column '15'). Open
$row = (new App\Db\Query())->select([
- 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 '263', column '8'). Open
new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
- 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 '203', column '8'). Open
new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END as user_name"),
- 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\Config' in method 'getHierarchy'. Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- 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 'getHierarchy'. Open
$listviewHeader[] = App\Language::translate($fieldname, 'Contacts');
- 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\Field' in method 'getHierarchy'. Open
if (\App\Field::getFieldPermission('Contacts', $colname)) {
- 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 'getChild'. Open
\App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') 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\Config' in method 'getChild'. Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Privilege' in method 'getHierarchyData'. Open
$hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
- 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 'getHierarchyData'. Open
\App\Log::trace('Exiting getHierarchyData 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\Config' in method 'getParent'. Open
if ($depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
- 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\Field' in method 'getHierarchyData'. Open
if (\App\Field::getFieldPermission('Contacts', $colname)) {
- 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 getHierarchyData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$data = '<strong>' . $data . '</strong>';
}
- 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 'getChild'. Open
if (empty($id) || $depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
- 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 getParent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$parentInfo[$columnname] = $row[$columnname];
}
- 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 getChild uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$childContactsInfo[$columnname] = $row[$columnname];
}
- 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\Record' in method 'getHierarchyData'. Open
$data = \App\Record::getLabel($data);
- 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 'getChild'. Open
$userNameSql = App\Module::getSqlForNameInDisplayFormat('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\Config' in method 'getParent'. Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- 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 'getParent'. Open
\App\Log::trace('Entering getParent(' . $id . ') 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\Log' in method 'getHierarchyData'. Open
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') 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\Config' in method 'getHierarchyData'. Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- 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\Purifier' in method 'getHierarchyData'. Open
$data = \App\Purifier::encodeHtml($baseInfo[$colname]);
- 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 'getParent'. Open
$userNameSql = App\Module::getSqlForNameInDisplayFormat('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 'getChild'. Open
\App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
- 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 getHierarchyData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$data = '<span>' . $data . ' <span class="fas fa-exclamation-circle"></span></span>';
}
- 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 'getParent'. Open
\App\Log::trace('Exiting getParent 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\Log' in method 'getParent'. Open
\App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
- 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 'getHierarchyData'. Open
$currentUser = Users_Privileges_Model::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\Log' in method 'getChild'. Open
\App\Log::trace('Exiting getChild 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
Define a constant instead of duplicating this literal "vtiger_contactdetails" 9 times. Open
public $table_name = 'vtiger_contactdetails';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "assigned_user_id" 4 times. Open
'Assigned To' => 'assigned_user_id',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "crmid" 6 times. Open
public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_contactdetails' => 'contactid', 'vtiger_contactaddress' => 'contactaddressid', 'vtiger_contactsubdetails' => 'contactsubscriptionid', 'vtiger_contactscf' => 'contactid', 'vtiger_customerdetails' => 'customerid', 'vtiger_entity_stats' => 'crmid'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "lastname" 5 times. Open
'Last Name' => 'lastname',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "parent_id" 5 times. Open
'Member Of' => 'parent_id',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "firstname" 4 times. Open
'First Name' => 'firstname',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "COLUMNS_IN_HIERARCHY" 4 times. Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "contactid" 9 times. Open
public $table_index = 'contactid';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_crmentity" 4 times. Open
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Remove this commented out code. Open
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
- Read upRead up
- Exclude checks
Programmers should not comment out code as it bloats programs and reduces readability.
Unused code should be deleted and can be retrieved from source control history if required.
See
- MISRA C:2004, 2.4 - Sections of code should not be "commented out".
- MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
- MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
- MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"
Define a constant instead of duplicating this literal "depth" 5 times. Open
$rows[$baseId] = $this->getChild($baseId, $rows[$baseId], $rows[$baseId]['depth']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "contactdetails" 3 times. Open
'First Name' => ['contactdetails' => 'firstname'],
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal ") method ..." 3 times. Open
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_contactscf" 3 times. Open
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Contacts" 10 times. Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$row = (new App\Db\Query())->select([
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering getParent(' . $id . ') method ...');
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END as user_name"),
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting getParent method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting getHierarchyData method ...');
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting getChild method ...');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new App\Db\Query())->select([
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function getHierarchy($id, $getRawData = false, $getLinks = true)
{
$listviewHeader = [];
$listviewEntries = [];
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- 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 270.
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 $emailTemplate_defaultFields. Keep variable name length under 20. Open
public $emailTemplate_defaultFields = ['firstname', 'lastname', 'title', 'email', 'department', 'phone', 'mobile'];
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Contacts extends CRMEntity
- Exclude checks
The property $tab_name_index is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $search_fields is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $search_fields_name is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $table_name is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $table_index is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $column_fields is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $mandatory_fields is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $emailTemplate_defaultFields is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $default_order_by is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $def_basicsearch_col is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $tab_name is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function getHierarchy($id, $getRawData = false, $getLinks = true)
- 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 property $list_fields_name is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $default_sort_order is not named in camelCase. Open
class Contacts extends CRMEntity
{
public $table_name = 'vtiger_contactdetails';
public $table_index = 'contactid';
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
- 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 function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0)
- 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 function getChild(int $id, array &$childRow, int $depthBase)
- 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
Spaces must be used to indent lines; tabs are not allowed Open
public $search_fields = [
- Exclude checks
Spaces must 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 $mandatory_fields = ['assigned_user_id', 'lastname', 'createdtime', 'modifiedtime'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $table_name = 'vtiger_contactdetails';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Member Of' => 'parent_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 $emailTemplate_defaultFields = ['firstname', 'lastname', 'title', 'email', 'department', 'phone', 'mobile'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $default_sort_order = '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
* Function to get the relation tables for related modules.
- Exclude checks
Spaces must 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 $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_contactdetails' => 'contactid', 'vtiger_contactaddress' => 'contactaddressid', 'vtiger_contactsubdetails' => 'contactsubscriptionid', 'vtiger_contactscf' => 'contactid', 'vtiger_customerdetails' => 'customerid', 'vtiger_entity_stats' => 'crmid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $search_fields_name = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = $this->list_fields_name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = \App\Purifier::encodeHtml($baseInfo[$colname]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $parent
- Exclude checks
Spaces must 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 ($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
public $def_basicsearch_col = 'lastname';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setRelationTables($secModule = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Products' => ['vtiger_seproductsrel' => ['crmid', 'productid'], 'vtiger_contactdetails' => 'contactid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Documents' => ['vtiger_senotesrel' => ['crmid', 'notesid'], 'vtiger_contactdetails' => 'contactid'],
- Exclude checks
Spaces must 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($listColumns)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($listColumns as $colname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = '<a href="index.php?module=Contacts&action=DetailView&record=' . $recordId . '">' . $data . '</a>';
- 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
$listColumns = $this->list_fields_name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $table_index = 'contactid';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
'Campaigns' => ['vtiger_campaign_records' => ['crmid', 'campaignid'], 'vtiger_contactdetails' => 'contactid'],
- Exclude checks
Spaces must 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordId != $id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to Recursively get all the parent.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$encountered[] = $parentid;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parentInfo['depth'] = $depth;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($listColumns as $columnname) {
- Exclude checks
Line exceeds 120 characters; contains 192 characters Open
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Exclude checks
Line exceeds 120 characters; contains 315 characters Open
public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_contactdetails' => 'contactid', 'vtiger_contactaddress' => 'contactaddressid', 'vtiger_contactsubdetails' => 'contactsubscriptionid', 'vtiger_contactscf' => 'contactid', 'vtiger_customerdetails' => 'customerid', 'vtiger_entity_stats' => 'crmid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Member Of' => ['contactdetails' => 'parent_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 (empty($listColumns)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($listColumns as $fieldname => $colname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listviewHeader[] = App\Language::translate($fieldname, 'Contacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to create array of all the contacts in the hierarchy.
- 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 array $listviewEntries
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Exclude checks
Spaces must 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 $parent;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $depthBase
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_contactdetails.reportsto' => $id])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($listColumns)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'First Name' => 'firstname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Email' => 'email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Office Phone' => 'phone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Last Name' => ['contactdetails' => 'lastname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Added these variables which are used as default order by and sortorder in ListView
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Campaigns' => ['vtiger_campaign_records' => ['crmid', 'campaignid'], 'vtiger_contactdetails' => 'contactid'],
- Exclude checks
Spaces must 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 = Users_Privileges_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting getHierarchyData method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())->select([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dataReader->count() > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getChild($childId, $childRow[$childId], $depth);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Mandatory table for supporting custom fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $column_fields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHierarchy($id, $getRawData = false, $getLinks = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Field::getFieldPermission('Contacts', $colname)) {
- Exclude checks
Spaces must 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 ($hasRecordViewAccess) {
- 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
$parentInfo[$columnname] = $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
$childContactsInfo[$columnname] = $row[$columnname];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Assigned To' => ['crmentity' => 'smownerid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Default Fields for Email Templates -- Pavani
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = 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
} elseif ('parent_id' === $colname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listviewEntries[$recordId] = $infoData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($rowInfo) && (int) $accId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('assigned_user_id' === $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
\App\Log::trace('Exiting getParent method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getChild(int $id, array &$childRow, int $depthBase)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childContactsInfo['depth'] = $depth;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $childRow;
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
* $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Contacts/Contacts.php,v 1.70 2005/04/27 11:21:49 rank Exp $
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $tab_name = ['vtiger_crmentity', 'vtiger_contactdetails', 'vtiger_contactaddress', 'vtiger_contactsubdetails', 'vtiger_contactscf', 'vtiger_customerdetails', 'vtiger_entity_stats'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'First Name' => ['contactdetails' => 'firstname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $relationFields = [];
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
'OSSMailView' => ['vtiger_ossmailview_relation' => ['crmid', 'ossmailviewid'], 'vtiger_contactdetails' => 'contactid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $relTables[$secModule];
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$data = '<a href="index.php?module=Contacts&action=DetailView&record=' . $recordId . '">' . $data . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $rowDepth . $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = \App\Record::getLabel($data);
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$listviewEntries = $this->getHierarchyData($id, $rowInfo, $accId, $listviewEntries, $getRawData, $getLinks);
- Exclude checks
Spaces must 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 array $childRow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childContactsInfo[$columnname] = $row['parentid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $customFieldTable = ['vtiger_contactscf', 'contactid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $list_fields_name = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['header' => $listviewHeader, 'entries' => $listviewEntries];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $listviewEntries;
- Exclude checks
Spaces must 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
$row = (new App\Db\Query())->select([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_contactdetails.*',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->from('vtiger_contactdetails')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getParent($parentid, $parent, $encountered, $depthBase + 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$depth = $parent[$parentid]['depth'] + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parentInfo[$columnname] = $row['user_name'];
- 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
'Last Name' => 'lastname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Used when enabling/disabling the mandatory fields for the module.
- Exclude checks
Spaces must 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 bool|string $secModule secondary module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relTables = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'OSSMailView' => ['vtiger_ossmailview_relation' => ['crmid', 'ossmailviewid'], 'vtiger_contactdetails' => 'contactid'],
- Exclude checks
Spaces must 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 === $secModule) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listviewEntries = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = '<span>' . $data . ' <span class="fas fa-exclamation-circle"></span></span>';
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$data = '<span>' . $data . ' <span class="fas fa-exclamation-circle"></span></span>';
- Exclude checks
Spaces must 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
$parentInfo[$columnname] = $row['parentid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $parent;
- 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 (empty($id) || $depthBase == App\Config::module('Contacts', 'MAX_HIERARCHY_DEPTH')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $childRow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($listColumns as $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
'Assigned To' => 'assigned_user_id',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] List of fields in the RelationListView
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// For Alphabetical search
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array with table names and fieldnames storing relations between module and this module
- Exclude checks
Spaces must 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
$baseId = current(array_keys($rows));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $getLinks
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = '<strong>' . $data . '</strong>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parentInfo = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$depth = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($listColumns)) {
- Exclude checks
Spaces must 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('assigned_user_id' === $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
* Function to get contacts hierarchy.
- Exclude checks
Spaces must 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 bool $getLinks
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = $this->list_fields_name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = $this->getParent($id, $rows, $encountered);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $getRawData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$infoData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userNameSql = App\Module::getSqlForNameInDisplayFormat('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
->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_contactdetails.contactid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Refers to vtiger_field.fieldname values.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $default_order_by = '';
- Exclude checks
Spaces must 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
$rows[$baseId] = $this->getChild($baseId, $rows[$baseId], $rows[$baseId]['depth']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId - id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($baseInfo as $accId => $rowInfo) {
- Exclude checks
Spaces must 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 int $depthBase
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0)
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END as user_name"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parentid = $row['reportsto'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($parent[$parentid])) {
- Exclude checks
Spaces must 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
$userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$depth = $depthBase + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = App\Config::module('Contacts', 'COLUMNS_IN_HIERARCHY');
- Exclude checks
Spaces must 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 = [$baseId => $rows[$baseId]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Contacts', 'DetailView', $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $getRawData && 'firstname' === $colname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowDepth = str_repeat(' .. ', $baseInfo['depth']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$infoData[] = $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $encountered
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_contactdetails.contactid' => $id])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' !== $parentid && 0 != $parentid && !\in_array($parentid, $encountered)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('parent_id' === $columnname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parent[$id] = $parentInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting getChild method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to Recursively get all the child.
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->from('vtiger_contactdetails')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childContactsInfo = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('parent_id' === $columnname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $relTables;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $getRawData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$encountered = [$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getHierarchyData($id, $rows[$baseId], $baseId, $listviewEntries, $getRawData, $getLinks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Field::getFieldPermission('Contacts', $colname)) {
- 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
$listviewHeader = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $baseInfo
- Exclude checks
Spaces must 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 ($getLinks) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listviewEntries = $this->getHierarchyData($id, $rowInfo, $accId, $listviewEntries, $getRawData, $getLinks);
- 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
\App\Log::trace('Entering getParent(' . $id . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN {$userNameSql} ELSE vtiger_groups.groupname END as user_name"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_contactdetails.contactid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->one();
- 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
'vtiger_contactdetails.*',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$listColumns = $this->list_fields_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
$childRow[$childId] = $childContactsInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childId = $row['contactid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childContactsInfo[$columnname] = $row['user_name'];
- Exclude checks