Function parseConditions
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
{
if (empty($conditions)) {
return '';
}
- 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 process
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- 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 parseConditions
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
{
if (empty($conditions)) {
return '';
}
Method process
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
The method process() has an NPath complexity of 1404. The configured NPath complexity threshold is 200. Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- 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 parseConditions() has an NPath complexity of 728. The configured NPath complexity threshold is 200. Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
{
if (empty($conditions)) {
return '';
}
- 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 process() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- 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 parseConditions() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
{
if (empty($conditions)) {
return '';
}
- 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 20 to the 15 allowed. Open
public function process()
- 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 45 to the 15 allowed. Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
- 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 parseConditions has a boolean flag argument $show, which is a certain sign of a Single Responsibility Principle violation. Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
- 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
Avoid assigning values to variables in if clauses and the like (line '51', column '104'). Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- 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 '\Vtiger_ListView_Model' in method 'process'. Open
$listView = \Vtiger_ListView_Model::getInstance($moduleModel->getName(), $cvId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '51', column '9'). Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '58', column '8'). Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Language' in method 'parseConditions'. Open
$groupTranslation = \App\Language::translate("LBL_{$group}");
- 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 parseConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$value[] = \App\Language::translate($fieldModel->getDisplayValue($val, false, false, true), $fieldModel->getModuleName());
}
- 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 '51', column '57'). Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- 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
The method parseConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$queryField = $queryGenerator->getQueryField($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 assigning values to variables in if clauses and the like (line '83', column '10'). Open
public function process()
{
$html = '';
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
$pdf = $this->textParser->getParam('pdf');
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Language' in method 'parseConditions'. Open
$value[] = \App\Language::translate($val, $fieldModel->getModuleName());
- 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_Record_Model' in method 'process'. Open
$sourceRecordModel = \Vtiger_Record_Model::getInstanceById($recordModel->get($sourceField));
- 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 'process'. Open
$html .= "<div style=\"{$bodyStyle}\">" . \App\Language::translate($customView->get('viewname'), $moduleModel->getName()) . '</div>';
- 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 'parseConditions'. Open
lcfirst(\App\Language::translate($operatorLabel, $fieldModel->getModuleName())) . '</strong> ' .
- 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\Record' in method 'process'. Open
if (($sourceField = $fieldModel->get('source_field_name')) && !$recordModel->isEmpty($sourceField) && \App\Record::isExists($recordModel->get($sourceField))) {
- 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_Module_Model' in method 'process'. Open
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->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 assigning values to variables in if clauses and the like (line '154', column '11'). Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
{
if (empty($conditions)) {
return '';
}
- 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
The method parseConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$html .= $text;
}
- 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 parseConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $rule['fieldname']), 3, false);
if ($sourceFieldName) {
$queryField = $queryGenerator->getQueryRelatedField([
'relatedModule' => $moduleName,
- 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 '\CustomView_Record_Model' in method 'process'. Open
$customView = \CustomView_Record_Model::getInstanceById($cvId);
- 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 parseConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$html .= "{$pre}";
}
- 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 'parseConditions'. Open
$value[] = \App\Language::translate($fieldModel->getDisplayValue($val, false, false, true), $fieldModel->getModuleName());
- 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_Record_Model' in method 'process'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->textParser->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\CustomView' in method 'process'. Open
$roles[] = \App\CustomView::getConditions($cvId);
- 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 'parseConditions'. Open
\App\Language::translate($fieldModel->getFieldLabel(), $fieldModel->getModuleName()) . ' <strong>' .
- 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 'process'. Open
$html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $this->textParser->moduleName) . '</th>';
- 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 "operator" 3 times. Open
if (($value = $pdf->getVariable('search_value')) && ($operator = $pdf->getVariable('operator')) && ($fieldModel = $fields[$pdf->getVariable('search_key')])) {
- 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 "rules" 4 times. Open
'rules' => array_filter($roles),
- 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 "condition" 4 times. Open
'condition' => 'AND',
- 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 "source_field_name" 3 times. Open
'fieldname' => $fieldModel->getCustomViewSelectColumnName((string) $fieldModel->get('source_field_name')),
- 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.
Avoid unused local variables such as '$html'. Open
$html = '';
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Call to deprecated function \Vtiger_Field_Model::getFieldLabel()
defined at /code/modules/Vtiger/models/Field.php:215
Open
$html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $this->textParser->moduleName) . '</th>';
- Exclude checks
Parameter $queryGenerator
has undeclared type \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
- Exclude checks
Argument 2 (moduleName)
is false
but \App\Language::translate()
takes string
defined at /code/app/Language.php:161
Open
$html .= "<div style=\"{$bodyStyle}\">" . \App\Language::translate($customView->get('viewname'), $moduleModel->getName()) . '</div>';
- Exclude checks
Reference to instance property moduleName
from undeclared class \App\TextParser
Open
$html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $this->textParser->moduleName) . '</th>';
- Exclude checks
Call to method getQueryField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryField = $queryGenerator->getQueryField($fieldName);
- Exclude checks
Call to method getQueryRelatedField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryField = $queryGenerator->getQueryRelatedField([
- Exclude checks
Argument 3 (params)
is array{}
but \Vtiger_Base_UIType::getTextParserDisplayValue()
takes string
defined at /code/modules/Vtiger/uitypes/Base.php:299
Open
$value = $fieldModel->getUITypeModel()->getTextParserDisplayValue($sourceRecordModel->get($fieldModel->getName()), $sourceRecordModel, []);
- Exclude checks
Reference to instance property moduleName
from undeclared class \App\TextParser
Open
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
- Exclude checks
Call to method parseSearchParams
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$roles[] = $listView->getQueryGenerator()->parseSearchParams($searchParams);
- Exclude checks
Argument 3 (params)
is array{}
but \Vtiger_Base_UIType::getTextParserDisplayValue()
takes string
defined at /code/modules/Vtiger/uitypes/Base.php:299
Open
$value = $fieldModel->getUITypeModel()->getTextParserDisplayValue($recordModel->get($fieldModel->getName()), $recordModel, []);
- Exclude checks
Call to method getParam
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$pdf = $this->textParser->getParam('pdf');
- Exclude checks
Reference to instance property moduleName
from undeclared class \App\TextParser
Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->textParser->moduleName);
- Exclude checks
Argument 1 (moduleName)
is false
but \Vtiger_ListView_Model::getInstance()
takes string
defined at /code/modules/Vtiger/models/ListView.php:35
Open
$listView = \Vtiger_ListView_Model::getInstance($moduleModel->getName(), $cvId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdf = $this->textParser->getParam('pdf');
- Exclude checks
Line exceeds 120 characters; contains 170 characters Open
if (($value = $pdf->getVariable('search_value')) && ($operator = $pdf->getVariable('operator')) && ($fieldModel = $fields[$pdf->getVariable('search_key')])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roles[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '<table class="records-list" style="border-collapse:collapse;width:100%;border:1px solid #ddd;"><thead><tr>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '</tr></thead><tbody>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$recordModel->isViewable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($conditions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$group = strtoupper($conditions['condition']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Process.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function process()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "<div style=\"{$bodyStyle}\">" . \App\Language::translate($customView->get('viewname'), $moduleModel->getName()) . '</div>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array('conditions', $params)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($value = $pdf->getVariable('search_value')) && ($operator = $pdf->getVariable('operator')) && ($fieldModel = $fields[$pdf->getVariable('search_key')])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($searchParams = $pdf->getVariable('search_params')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'condition' => 'AND',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$bodyStyle = 'border:1px solid #ddd;padding:4px; ';
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $this->textParser->moduleName) . '</th>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $type = 'pdf';
- Exclude checks
Spaces must 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 = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "<th style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->getFieldLabel(), $this->textParser->moduleName) . '</th>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '</tr>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Specific parse conditions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($rule['condition'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$showPartGroup = strtoupper($rule['condition']) !== $group;
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$html .= "<div style=\"font-size:9px;\">{$groupTranslation} " . (\count($rule['rules']) > 1 ? "({$text})" : $text) . '</div>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $name = 'LBL_TEXT_PARSER_RECORDS_LIST';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = $this->params ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => $value,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roles[] = \App\CustomView::getConditions($cvId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array|null $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
if ($sourceFieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $fieldModel->getUITypeModel()->getTextParserDisplayValue($sourceRecordModel->get($fieldModel->getName()), $sourceRecordModel, []);
- Exclude checks
Spaces must 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 '';
- 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
$fields = $listView->getListViewHeaders();
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$html .= '<table class="records-list" style="border-collapse:collapse;width:100%;border:1px solid #ddd;"><thead><tr>';
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$value = $fieldModel->getUITypeModel()->getTextParserDisplayValue($sourceRecordModel->get($fieldModel->getName()), $sourceRecordModel, []);
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $rule['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var mixed Parser type */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$bodyStyle = 'font-size:9px;';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$customView = \CustomView_Record_Model::getInstanceById($cvId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $html .= '</tbody</table>';
- Exclude checks
Spaces must 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
$listView = \Vtiger_ListView_Model::getInstance($moduleModel->getName(), $cvId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$headerStyle = 'text-align:center;background-color:#ddd;';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$count = $counter = \count($conditions['rules']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($showPartGroup) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "<div style=\"font-size:9px;\">{$groupTranslation} " . (\count($rule['rules']) > 1 ? "({$text})" : $text) . '</div>';
- 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
$cvId = $pdf->getVariable('viewname');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupTranslation = \App\Language::translate("LBL_{$group}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= $text;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cvId = $listView->get('viewId');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'rules' => array_filter($roles),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= $this->parseConditions($conditions, $listView->getQueryGenerator());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Vtiger_Module_Model::getInstance($this->textParser->moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ids = [$ids];
- Exclude checks
Spaces must 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 (!$fieldModel->get('source_field_name')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "<td style=\"{$bodyStyle}\">" . $value . '</td>';
- Exclude checks
Spaces must 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
if (!($operatorLabel = \App\Condition::STANDARD_OPERATORS[$operator] ?? '')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Language::translate($fieldModel->getFieldLabel(), $fieldModel->getModuleName()) . ' <strong>' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Class name */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($ids)) {
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$html .= "<div style=\"{$bodyStyle}\">" . \App\Language::translate($customView->get('viewname'), $moduleModel->getName()) . '</div>';
- Exclude checks
Spaces must 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
private function parseConditions(?array $conditions, \App\QueryGenerator $queryGenerator, string $html = '', bool $show = false): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions['rules'] as $rule) {
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$queryValue = method_exists($queryField, 'getArrayValue') ? $queryField->getArrayValue() : $queryField->getValue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $html;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ids = $pdf->getVariable('recordsId');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array('viewName', $params) && $cvId) {
- Exclude checks
Spaces must 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 $recordId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryField->setOperator($rule['operator']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryValue = false !== strpos($queryValue, $separator) ? explode($separator, $queryValue) : [$queryValue];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
--$counter;
- Exclude checks
Spaces must 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[] = $listView->getQueryGenerator()->parseSearchParams($searchParams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->textParser->moduleName);
- Exclude checks
Line exceeds 120 characters; contains 175 characters Open
if (($sourceField = $fieldModel->get('source_field_name')) && !$recordModel->isEmpty($sourceField) && \App\Record::isExists($recordModel->get($sourceField))) {
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
$value = $fieldModel->getUITypeModel()->getTextParserDisplayValue($recordModel->get($fieldModel->getName()), $recordModel, []);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\QueryGenerator $queryGenerator
- Exclude checks
Spaces must 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
$text = $this->parseConditions($rule, $queryGenerator, '', $showPartGroup);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = implode(', ', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value . '</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
$html .= '<tr>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($sourceField = $fieldModel->get('source_field_name')) && !$recordModel->isEmpty($sourceField) && \App\Record::isExists($recordModel->get($sourceField))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $fieldModel->getUITypeModel()->getTextParserDisplayValue($recordModel->get($fieldModel->getName()), $recordModel, []);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $show
- 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
$operator = $queryField->getOperator();
- Exclude checks
Spaces must 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
'fieldname' => $fieldModel->getCustomViewSelectColumnName((string) $fieldModel->get('source_field_name')),
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
'fieldname' => $fieldModel->getCustomViewSelectColumnName((string) $fieldModel->get('source_field_name')),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operator' => $operator,
- Exclude checks
Spaces must 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
$sourceRecordModel = \Vtiger_Record_Model::getInstanceById($recordModel->get($sourceField));
- Exclude checks
Spaces must 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 $html
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$showGroup = $show || 'AND' !== $group;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryField->setValue($rule['value']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($queryValue as $val) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($counter && $count !== $counter && $showGroup) {
- 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
$separator = '##';
- Exclude checks
Spaces must 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 121 characters Open
\App\Language::translate($fieldModel->getFieldLabel(), $fieldModel->getModuleName()) . ' <strong>' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "<div style=\"font-size:9px;\">{$pre}</div>";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedModule' => $moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$operatorLabel = \App\Condition::DATE_OPERATORS[$operator] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryField = $queryGenerator->getQueryRelatedField([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = [];
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$queryValue = false !== strpos($queryValue, $separator) ? explode($separator, $queryValue) : [$queryValue];
- Exclude checks
Spaces must 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[] = \App\Language::translate($val, $fieldModel->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pre = '<span style="font-size:9px;">' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedField' => $fieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sourceField' => $sourceFieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldModel->isReferenceField()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
lcfirst(\App\Language::translate($operatorLabel, $fieldModel->getModuleName())) . '</strong> ' .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!$show) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryField = $queryGenerator->getQueryField($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value[] = \App\Language::translate($fieldModel->getDisplayValue($val, false, false, true), $fieldModel->getModuleName());
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$value[] = \App\Language::translate($fieldModel->getDisplayValue($val, false, false, true), $fieldModel->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $queryField->getField();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "<span style=\"font-size:9px;\">{$groupTranslation} </span>{$pre}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= "{$pre}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryValue = method_exists($queryField, 'getArrayValue') ? $queryField->getArrayValue() : $queryField->getValue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($queryValue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks