Function validSearchParams
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public static function validSearchParams(string $moduleName, array $searchParams, $convert = true): array
{
$searchParamsCount = \count($searchParams);
if ($searchParamsCount > 2) {
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class Condition has an overall complexity of 58 which is very high. The configured complexity threshold is 50. Open
class Condition
{
/**
* @var array Data filter list.
*/
- Exclude checks
File Condition.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Condition main class.
*
Function removeFieldFromCondition
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function removeFieldFromCondition(string $baseModuleName, array $conditions, string $moduleName, string $fieldName): array
{
if (isset($conditions['rules'])) {
foreach ($conditions['rules'] as $key => &$condition) {
if (isset($condition['condition'])) {
- 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 parseConditions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function parseConditions(?array $conditions, \Vtiger_Record_Model $recordModel): bool
{
if (empty($conditions) || empty($conditions['rules'])) {
return true;
}
- 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 validSearchParams
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validSearchParams(string $moduleName, array $searchParams, $convert = true): array
{
$searchParamsCount = \count($searchParams);
if ($searchParamsCount > 2) {
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
Function getFieldsFromConditions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getFieldsFromConditions(array $conditions): array
{
$fields = ['baseModule' => [], 'referenceModule' => []];
if (isset($conditions['rules'])) {
foreach ($conditions['rules'] as &$condition) {
- 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 getConditionsFromRequest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getConditionsFromRequest(array $conditions): array
{
if (isset($conditions['rules'])) {
foreach ($conditions['rules'] as &$condition) {
if (isset($condition['condition'])) {
- 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 checkCondition
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkCondition(array $rule, \Vtiger_Record_Model $recordModel): bool
{
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $rule['fieldname']), 3, false);
if ($sourceFieldName) {
if ($recordModel->isEmpty($sourceFieldName)) {
Function checkCondition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function checkCondition(array $rule, \Vtiger_Record_Model $recordModel): bool
{
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $rule['fieldname']), 3, false);
if ($sourceFieldName) {
if ($recordModel->isEmpty($sourceFieldName)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method removeFieldFromCondition() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public static function removeFieldFromCondition(string $baseModuleName, array $conditions, string $moduleName, string $fieldName): array
{
if (isset($conditions['rules'])) {
foreach ($conditions['rules'] as $key => &$condition) {
if (isset($condition['condition'])) {
- 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 validSearchParams() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public static function validSearchParams(string $moduleName, array $searchParams, $convert = true): array
{
$searchParamsCount = \count($searchParams);
if ($searchParamsCount > 2) {
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
- 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 19 to the 15 allowed. Open
public static function removeFieldFromCondition(string $baseModuleName, array $conditions, string $moduleName, string $fieldName): array
- 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 28 to the 15 allowed. Open
public static function validSearchParams(string $moduleName, array $searchParams, $convert = true): array
- 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
Missing class import via use statement (line '325', column '14'). Open
throw new \App\Exceptions\AppException("ERR_NOT_FOUND_QUERY_FIELD_CONDITION|$fieldName|$className");
- 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 '320', column '14'). Open
throw new \App\Exceptions\AppException('ERR_NOT_FOUND_FIELD_MODEL|' . $fieldName);
- 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 '411', column '16'). Open
throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $v, 406);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method validSearchParams has a boolean flag argument $convert, which is a certain sign of a Single Responsibility Principle violation. Open
public static function validSearchParams(string $moduleName, array $searchParams, $convert = true): array
- 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 using static access to class 'App\Utils' in method 'validSearchParams'. Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- 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 'checkCondition'. Open
Log::error("Not found field model | Field name: $fieldName | Module: $moduleName", 'Condition');
- 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 '389', column '14'). Open
public static function removeFieldFromCondition(string $baseModuleName, array $conditions, string $moduleName, string $fieldName): array
{
if (isset($conditions['rules'])) {
foreach ($conditions['rules'] as $key => &$condition) {
if (isset($condition['condition'])) {
- 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\Utils' in method 'validSearchParams'. Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
- 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\Utils' in method 'validSearchParams'. Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$count}|| <> 3 or 4||" . Utils::varExport($param, true), 406);
- 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 checkCondition uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$recordField = new $className($recordModel, $fieldModel, $rule);
}
- 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 getFieldsFromConditions 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(':', $condition['fieldname']), 3, false);
if ($sourceFieldName) {
$fields['referenceModule'][$moduleName][$sourceFieldName] = $fieldName;
} else {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method getFieldsFromConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fields['baseModule'][] = $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
The method getConditionsFromRequest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$operator = $condition['operator'];
$value = $condition['value'] ?? '';
if (!\in_array($operator, array_merge(self::OPERATORS_WITHOUT_VALUES, self::FIELD_COMPARISON_OPERATORS, array_keys(self::DATE_OPERATORS)))) {
[$fieldName, $fieldModuleName,] = array_pad(explode(':', $condition['fieldname']), 3, false);
- 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 validSearchParams uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (!isset($fields[$param[0]])) {
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
}
$value = $fields[$param[0]]->getUITypeModel()->getDbConditionBuilderValue($param[2], $param[1]);
- 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 {
$ruleResult = self::checkCondition($rule, $recordModel);
}
- 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\Utils' in method 'validSearchParams'. Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- 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 'checkCondition'. Open
Log::error("Not found record field condition | Field name: $fieldName | Module: $moduleName | FieldDataType: " . ucfirst($fieldModel->getFieldDataType()), 'Condition');
- 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 removeFieldFromCondition uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
[$cFieldName, $cModuleName, $sourceFieldName] = array_pad(explode(':', $condition['fieldname']), 3, false);
if (($fieldName === $cFieldName && $moduleName === $cModuleName) || ($sourceFieldName && $sourceFieldName === $fieldName && $moduleName === $baseModuleName)) {
$condition = [];
}
- 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 '\Vtiger_Record_Model' in method 'checkCondition'. Open
$sourceRecordModel = self::$recordCache[$recordModel->get($sourceFieldName)] ?? \Vtiger_Record_Model::getInstanceById($recordModel->get($sourceFieldName));
- 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\Validator' in method 'validAdvancedConditions'. Open
if (!\App\Validator::integer($v)) {
- 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 "fieldname" 4 times. Open
[$fieldName, $fieldModuleName,] = array_pad(explode(':', $condition['fieldname']), 3, false);
- 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 "relationConditions" 3 times. Open
if (!empty($advancedConditions['relationConditions']) && 0 != $advancedConditions['relationId']) {
- 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" 11 times. Open
if (isset($conditions['rules'])) {
- 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" 5 times. Open
if (isset($condition['condition'])) {
- 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 "label" 33 times. Open
'custom' => ['label' => 'LBL_CUSTOM'],
- 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 integer
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
if (!\App\Validator::integer($v)) {
- Exclude checks
Call to method getField
from undeclared class \App\Vtiger_Record_Model
Open
$fieldModel = $sourceRecordModel->getField($fieldName);
- Exclude checks
Property \App\Condition::$recordCache
has undeclared type \App\Vtiger_Record_Model[]
Open
private static $recordCache = [];
- Exclude checks
Call with 2 arg(s) to \App\Utils::varExport()
which only takes 1 arg(s) defined at /code/app/Utils.php:38
Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
- Exclude checks
Call with 2 arg(s) to \App\Utils::varExport()
which only takes 1 arg(s) defined at /code/app/Utils.php:38
Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error("Not found record field condition | Field name: $fieldName | Module: $moduleName | FieldDataType: " . ucfirst($fieldModel->getFieldDataType()), 'Condition');
- Exclude checks
Call with 2 arg(s) to \App\Utils::varExport()
which only takes 1 arg(s) defined at /code/app/Utils.php:38
Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$count}|| <> 3 or 4||" . Utils::varExport($param, true), 406);
- Exclude checks
Call with 2 arg(s) to \App\Utils::varExport()
which only takes 1 arg(s) defined at /code/app/Utils.php:38
Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error("Not found field model | Field name: $fieldName | Module: $moduleName", 'Condition');
- Exclude checks
Avoid variables with short names like $v. Configured minimum length is 3. Open
array_map(function ($v) {
- 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
'prevfy' => ['label' => 'LBL_PREVIOUS_FY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'greaterthannow' => ['label' => 'LBL_GREATER_THAN_NOW'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const DATE_OPERATORS = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array Data filter list.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'smallerthannow' => ['label' => 'LBL_SMALLER_THAN_NOW'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'custom' => ['label' => 'LBL_CUSTOM'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextworkingday' => ['label' => 'LBL_NEXT_WORKING_DAY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'b' => 'LBL_BEFORE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nom' => 'LBL_USER_CURRENTLY_NOT_LOGGED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'wr' => 'LBL_IS_WATCHING_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prevfq',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last15days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($fields[$referenceField], $relatedFields[$relatedFieldName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'yesterday' => ['label' => 'LBL_YESTERDAY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'untiltoday' => ['label' => 'LBL_UNTIL_TODAY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'lastweek' => ['label' => 'LBL_LAST_WEEK'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next60days' => ['label' => 'LBL_NEXT_60_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const FIELD_COMPARISON_OPERATORS = ['ef', 'nf', 'lf', 'gf', 'mf', 'hf'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] Operators without values.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thisfq',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last90days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last120days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($searchParamsCount > 2) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nwr' => 'LBL_IS_NOT_WATCHING_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'gf' => 'LBL_GREATER_THAN_FIELD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextweek',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thismonth',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $searchParams
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$count}|| <> 3 or 4||" . Utils::varExport($param, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thisfy' => ['label' => 'LBL_CURRENT_FY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextfq' => ['label' => 'LBL_NEXT_FQ'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'previousworkingday' => ['label' => 'LBL_PREVIOUS_WORKING_DAY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last7days' => ['label' => 'LBL_LAST_7_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next90days' => ['label' => 'LBL_NEXT_90_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ny' => 'LBL_IS_NOT_EMPTY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thisfy',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'lastweek',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextmonth',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last60days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prevfq' => ['label' => 'LBL_PREVIOUS_FQ'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'e' => 'LBL_EQUALS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'kh' => 'LBL_DOES_NOT_CONTAIN_HIERARCHY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'a' => 'LBL_AFTER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'hf' => 'LBL_GREATER_OR_EQUAL_FIELD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'greaterthannow',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next90days',
- Exclude checks
Spaces must 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 ($params as $param) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedFields = \Vtiger_Module_Model::getInstance($relatedModule)->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thisfq' => ['label' => 'LBL_CURRENT_FQ'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
's' => 'LBL_STARTS_WITH',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ef' => 'LBL_EQUALS_FIELD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next15days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'previousworkingday',
- Exclude checks
Spaces must 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
[$relatedFieldName, $relatedModule, $referenceField] = array_pad(explode(':', $param[0]), 3, null);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tomorrow' => ['label' => 'LBL_TOMORROW'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'k' => 'LBL_DOES_NOT_CONTAIN',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'g' => 'LBL_GREATER_THAN',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bw' => 'LBL_BETWEEN',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ogu' => 'LBL_USERS_GROUP_LOGGED_IN_USER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thisweek',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextfy' => ['label' => 'LBL_NEXT_FY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'moreThanDaysAgo' => ['label' => 'LBL_DATE_CONDITION_MORE_THAN_DAYS_AGO'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] Supported advanced filter operations.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'h' => 'LBL_GREATER_OR_EQUAL',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'mf' => 'LBL_LESS_THAN_OR_EQUAL_FIELD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last60days' => ['label' => 'LBL_LAST_60_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$count}|| <> 3 or 4||" . Utils::varExport($param, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last120days' => ['label' => 'LBL_LAST_120_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next30days' => ['label' => 'LBL_NEXT_30_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'n' => 'LBL_NOT_EQUAL_TO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ch' => 'LBL_CONTAINS_HIERARCHY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'lf' => 'LBL_LESS_THAN_FIELD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last7days',
- Exclude checks
Spaces must 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
'ro' => 'LBL_IS_RECORD_OPEN',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const OPERATORS_WITHOUT_VALUES = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last30days',
- Exclude checks
Spaces must 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 = \count($param);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relatedModule) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'l' => 'LBL_LESS_THAN',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'y' => 'LBL_IS_EMPTY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'om' => 'LBL_CURRENTLY_LOGGED_USER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ogr' => 'LBL_CURRENTLY_LOGGED_USER_GROUP',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'hs' => 'LBL_HAS_CHANGED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'hst' => 'LBL_HAS_CHANGED_TO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'today',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'lastmonth',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next30days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next120days',
- Exclude checks
Spaces must 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 $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempParam = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (3 !== $count && 4 !== $count) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'lastmonth' => ['label' => 'LBL_LAST_MONTH'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextmonth' => ['label' => 'LBL_NEXT_MONTH'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last30days' => ['label' => 'LBL_LAST_30_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last90days' => ['label' => 'LBL_LAST_90_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prevfy',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next60days',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var Vtiger_Record_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$searchParamsCount = \count($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
'today' => ['label' => 'LBL_TODAY'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thismonth' => ['label' => 'LBL_CURRENT_MONTH'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next15days' => ['label' => 'LBL_NEXT_15_DAYS'],
- Exclude checks
Spaces must 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
const STANDARD_OPERATORS = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tomorrow',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Vtiger_Record_Model instance cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function validSearchParams(string $moduleName, array $searchParams, $convert = true): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($param)) {
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'c' => 'LBL_CONTAINS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'smallerthannow',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextfy',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'untiltoday',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $recordCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $convert
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last15days' => ['label' => 'LBL_LAST_15_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'next120days' => ['label' => 'LBL_NEXT_120_DAYS'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] List of field comparison operators
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ew' => 'LBL_ENDS_WITH',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \App\Exceptions\IllegalValue
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = \Vtiger_Module_Model::getInstance($moduleName)->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $conditions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::parseConditions($conditions, $recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($conditions) || empty($conditions['rules'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $ruleResult;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordModel->isEmpty($sourceFieldName)) {
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$sourceRecordModel = self::$recordCache[$recordModel->get($sourceFieldName)] ?? \Vtiger_Record_Model::getInstanceById($recordModel->get($sourceFieldName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $recordModel->getField($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'thisweek' => ['label' => 'LBL_CURRENT_WEEK'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextweek' => ['label' => 'LBL_NEXT_WEEK'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'm' => 'LBL_LESS_THAN_OR_EQUAL',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'rc' => 'LBL_IS_RECORD_CLOSED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nco' => 'LBL_NOT_CREATED_BY_OWNER',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nf' => 'LBL_NOT_EQUAL_TO_FIELD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'y', 'ny', 'om', 'nom', 'ogr', 'wr', 'nwr', 'hs', 'ro', 'rc', 'nco', 'ogu',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'yesterday',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nextworkingday',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Checks structure search_params.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue("ERR_NUMBER_OF_ARGUMENTS_NOT_ALLOWED||{$searchParamsCount}|| > 2||" . Utils::varExport($searchParams, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($searchParams as $params) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $operator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceRecordModel = self::$recordCache[$recordModel->get($sourceFieldName)] ?? \Vtiger_Record_Model::getInstanceById($recordModel->get($sourceFieldName));
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result[] = $tempParam;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($conditions['rules'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($recordModel->getModuleName() === $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($fieldModel)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (0 === strpos($param[0], 'relationColumn_') && preg_match('/(^relationColumn_)(\d+)$/', $param[0])) {
- Exclude checks
Spaces must 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
$operator = $condition['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
$ruleResult = self::parseConditions($rule, $recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function checkCondition(array $rule, \Vtiger_Record_Model $recordModel): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 180 characters Open
Log::error("Not found record field condition | Field name: $fieldName | Module: $moduleName | FieldDataType: " . ucfirst($fieldModel->getFieldDataType()), 'Condition');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $result;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function validSearchValue(string $value, string $moduleName, string $fieldName, string $operator): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return condition from request.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition = static::getConditionsFromRequest($condition);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$andCondition && $ruleResult) {
- Exclude checks
Spaces must 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, $moduleName, $sourceFieldName] = array_pad(explode(':', $rule['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $relatedFields[$relatedFieldName]->getUITypeModel()->getDbConditionBuilderValue($param[2], $param[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($fields[$param[0]])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($operator, array_merge(self::OPERATORS_WITHOUT_VALUES, self::FIELD_COMPARISON_OPERATORS, array_keys(self::DATE_OPERATORS)))) {
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
if (!\in_array($operator, array_merge(self::OPERATORS_WITHOUT_VALUES, self::FIELD_COMPARISON_OPERATORS, array_keys(self::DATE_OPERATORS)))) {
- Exclude checks
Spaces must 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
$andCondition = 'AND' === $conditions['condition'];
- Exclude checks
Spaces must 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 string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions['rules'] as &$condition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check one condition.
- 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
Log::error("Not found record field condition | Field name: $fieldName | Module: $moduleName | FieldDataType: " . ucfirst($fieldModel->getFieldDataType()), 'Condition');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\IllegalValue("ERR_FIELD_NOT_FOUND||{$param[0]}||" . Utils::varExport($param, true), 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Vtiger_Module_Model::getInstance($moduleName)->getField($fieldName)->getUITypeModel()->getDbConditionBuilderValue($value, $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
foreach ($conditions['rules'] as $rule) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException("ERR_NOT_FOUND_QUERY_FIELD_CONDITION|$fieldName|$className");
- Exclude checks
Spaces must 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 ($convert) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$param[2] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
public static function validSearchValue(string $value, string $moduleName, string $fieldName, string $operator): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($condition['condition'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$className = '\App\Conditions\RecordFields\\' . ucfirst($fieldModel->getFieldDataType()) . 'Field';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Checks value search_value.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordField = new $className($sourceRecordModel, $fieldModel, $rule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = \Vtiger_Module_Model::getInstance($fieldModuleName)->getFieldByName($fieldName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function checkConditions(array $conditions, \Vtiger_Record_Model $recordModel): bool
- 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 string $fieldName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' !== $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->getUITypeModel()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $rule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($andCondition && !$ruleResult) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::error("Not found field model | Field name: $fieldName | Module: $moduleName", 'Condition');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tempParam[] = $param;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
\Vtiger_Module_Model::getInstance($moduleName)->getField($fieldName)->getUITypeModel()->getDbConditionBuilderValue($value, $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
$value = $condition['value'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $sourceRecordModel->getField($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($sourceFieldName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getConditionsFromRequest(array $conditions): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$fieldName, $fieldModuleName,] = array_pad(explode(':', $condition['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ruleResult = self::checkCondition($rule, $recordModel);
- Exclude checks
Spaces must 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
$value = (int) $param[2];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $fields[$param[0]]->getUITypeModel()->getDbConditionBuilderValue($param[2], $param[1]);
- Exclude checks
Spaces must 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 $value
- 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
->getDbConditionBuilderValue($value, $operator);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition['value'] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array|null $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static function parseConditions(?array $conditions, \Vtiger_Record_Model $recordModel): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('ERR_NOT_FOUND_FIELD_MODEL|' . $fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!class_exists($className)) {
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$value = $relatedFields[$relatedFieldName]->getUITypeModel()->getDbConditionBuilderValue($param[2], $param[1]);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
} elseif (0 === strpos($param[0], 'relationColumn_') && preg_match('/(^relationColumn_)(\d+)$/', $param[0])) {
- Exclude checks
Spaces must 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
* Parse conditions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $result;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check all conditions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = array_merge_recursive($fields, static::getFieldsFromConditions($condition));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($fieldName === $cFieldName && $moduleName === $cModuleName) || ($sourceFieldName && $sourceFieldName === $fieldName && $moduleName === $baseModuleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($conditions['rules'][$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Validator::integer($v)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $condition['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields['baseModule'][] = $fieldName;
- 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
/**
- 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
* Checks structure advancedConditions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function removeFieldFromCondition(string $baseModuleName, array $conditions, string $moduleName, string $fieldName): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions['rules'] as $key => &$condition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($condition['condition'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition = static::removeFieldFromCondition($baseModuleName, $condition, $moduleName, $fieldName);
- 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
$fields['referenceModule'][$moduleName][$sourceFieldName] = $fieldName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove field from conditions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
throw new \App\Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $v, 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}, $advancedConditions['relationColumns']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName The module name of the field to be deleted.
- Exclude checks
Spaces must 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 (!empty($advancedConditions['relationColumns'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordField->setSource($recordModel, $sourceFieldName);
- Exclude checks
Spaces must 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 ['baseModule' => [], 'referenceModule' => []]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions['rules'] as &$condition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$advancedConditions['relationConditions'] = self::getConditionsFromRequest($advancedConditions['relationConditions']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getFieldsFromConditions(array $conditions): 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
* @param string $fieldName The name of the field to be deleted
- Exclude checks
Spaces must 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
array_map(function ($v) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get field names from 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
* @param array $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$cFieldName, $cModuleName, $sourceFieldName] = array_pad(explode(':', $condition['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($condition)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($condition['condition'])) {
- Exclude checks
Spaces must 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 $advancedConditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function validAdvancedConditions(array $advancedConditions): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordField->check();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
[$cFieldName, $cModuleName, $sourceFieldName] = array_pad(explode(':', $condition['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
[$fieldName, $moduleName, $sourceFieldName] = array_pad(explode(':', $condition['fieldname']), 3, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
if (($fieldName === $cFieldName && $moduleName === $cModuleName) || ($sourceFieldName && $sourceFieldName === $fieldName && $moduleName === $baseModuleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition = [];
- Exclude checks
Spaces must 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
$advancedConditions['relationConditions'] = self::getConditionsFromRequest($advancedConditions['relationConditions']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = ['baseModule' => [], 'referenceModule' => []];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($conditions['rules'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($advancedConditions['relationConditions']) && 0 != $advancedConditions['relationId']) {
- Exclude checks
Spaces must 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
$recordField = new $className($recordModel, $fieldModel, $rule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($conditions['rules'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
if (empty($conditions['rules'] = array_filter($conditions['rules']))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $baseModuleName The base name of the module for which conditions have been set
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
public static function removeFieldFromCondition(string $baseModuleName, array $conditions, string $moduleName, string $fieldName): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $advancedConditions;
- Exclude checks