Function doTask
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
public function doTask($recordModel)
{
$moduleName = $recordModel->getModuleName();
$recordId = $recordModel->getId();
$entityType = $this->entity_type;
- 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 setFieldMapping
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
{
$ownerFields = [];
$entityType = $this->entity_type;
foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
- 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 doTask
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doTask($recordModel)
{
$moduleName = $recordModel->getModuleName();
$recordId = $recordModel->getId();
$entityType = $this->entity_type;
The class VTCreateEntityTask has an overall complexity of 56 which is very high. The configured complexity threshold is 50. Open
class VTCreateEntityTask extends VTTask
{
public $executeImmediately = true;
public function getFieldNames()
- Exclude checks
Method setFieldMapping
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
{
$ownerFields = [];
$entityType = $this->entity_type;
foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
The method doTask() has an NPath complexity of 972. The configured NPath complexity threshold is 200. Open
public function doTask($recordModel)
{
$moduleName = $recordModel->getModuleName();
$recordId = $recordModel->getId();
$entityType = $this->entity_type;
- 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 doTask() has a Cyclomatic Complexity of 35. The configured cyclomatic complexity threshold is 10. Open
public function doTask($recordModel)
{
$moduleName = $recordModel->getModuleName();
$recordId = $recordModel->getId();
$entityType = $this->entity_type;
- 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 setFieldMapping() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
{
$ownerFields = [];
$entityType = $this->entity_type;
foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
- 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 76 to the 15 allowed. Open
public function doTask($recordModel)
- 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 41 to the 15 allowed. Open
public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
- 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 '57', column '71'). Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- 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 '148', column '26'). Open
$exprEvaluater = new VTFieldExpressionEvaluater($expression);
- 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 '146', column '19'). Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- 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 '146', column '42'). Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- 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 '146', column '70'). Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- 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 '57', column '20'). Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- 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 '57', column '43'). Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- 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 '59', column '27'). Open
$exprEvaluater = new VTFieldExpressionEvaluater($expression);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'App\User' in method 'setFieldMapping'. Open
$userId = App\User::getUserIdByName($fieldValue);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Json' in method 'doTask'. Open
$fieldValueMapping = \App\Json::decode($this->field_value_mapping);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = $sourceModuleName === $entityType ? $newRecordModel->get($fieldValue) : $fieldValue = $recordModel->get($fieldValue);
}
- 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 'doTask'. Open
$newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);
- 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 doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = (!$userId) ? $groupId : $userId;
}
- 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\Fields\Owner' in method 'setFieldMapping'. Open
$groupId = \App\Fields\Owner::getGroupId($fieldValue);
- 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 setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = $exprEvaluater->evaluate($parentRecordModel);
}
- 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 doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = $exprEvaluater->evaluate($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\Fields\Owner' in method 'doTask'. Open
$groupId = \App\Fields\Owner::getGroupId($fieldValue);
- 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 'doTask'. Open
$newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);
- 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_Relation_Model' in method 'doTask'. Open
$relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'doTask'. Open
if (!\App\Module::isModuleActive($entityType)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\User' in method 'doTask'. Open
$userId = App\User::getUserIdByName($fieldValue);
- 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 setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = 0;
}
- 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 setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = $sourceModuleName === $entityType ? $fieldValue = $recordModel->get($fieldValue) : $fieldValue = $parentRecordModel->get($fieldValue);
}
- 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 doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = '0';
}
- 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 '100', column '42'). Open
public function doTask($recordModel)
{
$moduleName = $recordModel->getModuleName();
$recordId = $recordModel->getId();
$entityType = $this->entity_type;
- 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_Record_Model' in method 'doTask'. Open
$parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldValue = (!$userId) ? $groupId : $userId;
}
- 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_RelationListView_Model' in method 'doTask'. Open
if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {
- 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 = $fieldInfo['fieldname'];
- 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 "modulename" 4 times. Open
$destinyModuleName = $this->getDestinyModuleName($fieldInfo['modulename']);
- 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.
Reference to undeclared property \VTCreateEntityTask->entity_type
Open
$entityType = $this->entity_type;
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->relationId
Open
if ($this->relationId) {
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->reference_field
Open
$newRecordModel->set($this->reference_field, $recordId);
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->relationId
Open
if ($this->relationId) {
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->mappingPanel
Open
} elseif ($this->mappingPanel && $entityType) {
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->verifyIfExists
Open
if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {
- Exclude checks
Call to method getGroupId
from undeclared class \App\Fields\Owner
Open
$groupId = \App\Fields\Owner::getGroupId($fieldValue);
- Exclude checks
Call to method getGroupId
from undeclared class \App\Fields\Owner
Open
$groupId = \App\Fields\Owner::getGroupId($fieldValue);
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->mappingPanel
Open
if (!$this->mappingPanel && !empty($entityType) && !empty($fieldValueMapping) && \count($fieldValueMapping) > 0) {
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->field_value_mapping
(Did you mean $fieldValueMapping) Open
if (!empty($this->field_value_mapping)) {
- Exclude checks
Reference to undeclared property \Vtiger_Record_Model->executeUser
Open
$fieldValue = $recordModel->executeUser;
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->field_value_mapping
(Did you mean $fieldValueMapping) Open
$fieldValueMapping = \App\Json::decode($this->field_value_mapping);
- Exclude checks
Call to method getUserIdByName
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userId = App\User::getUserIdByName($fieldValue);
- Exclude checks
Call to method getUserIdByName
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userId = App\User::getUserIdByName($fieldValue);
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->relationId
Open
$relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);
- Exclude checks
Reference to undeclared property \VTCreateEntityTask->entity_type
Open
$entityType = $this->entity_type;
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
} elseif ('expression' == $fieldValueType) {
require_once 'modules/com_vtiger_workflow/expression_engine/include.php';
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
$expression = $parser->expression();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 96.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
} elseif ('expression' === $fieldValueType) {
require_once 'modules/com_vtiger_workflow/expression_engine/include.php';
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
$expression = $parser->expression();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 96.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class VTCreateEntityTask extends VTTask
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 11. Open
<?php
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValueMapping = [];
- 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 ($sourceModuleName === $entityType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mandatoryFields = $newRecordModel->getModule()->getMandatoryFieldModels();
- 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
$fieldValue = $parentRecordModel->get($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
$entityType = $this->entity_type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValueType = $fieldInfo['valuetype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('fieldname' === $fieldValueType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$userId && !$groupId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerFields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$exprEvaluater = new VTFieldExpressionEvaluater($expression);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (preg_match('/([^:]+):boolean$/', $fieldValue, $match)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $destinyModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function doTask($recordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = trim($fieldInfo['value']);
- 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
$fieldValue = $exprEvaluater->evaluate($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('true' == $fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $recordModel->executeUser;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel->setHandlerExceptions(['disableHandlerClasses' => ['Vtiger_Workflow_Handler']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel = $this->setFieldMapping($fieldValueMapping, $newRecordModel, $parentRecordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' === $newRecordModel->get($field->getName()) || null === $newRecordModel->get($field->getName())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $exprEvaluater->evaluate($parentRecordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = explode('::', $destinyModuleName)[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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel->set($fieldName, $fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relationModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldValueMapping as $fieldInfo) {
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
$fieldValue = $sourceModuleName === $entityType ? $fieldValue = $recordModel->get($fieldValue) : $fieldValue = $parentRecordModel->get($fieldValue);
- Exclude checks
Spaces must 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
$destinyModuleName = $this->getDestinyModuleName($fieldInfo['modulename']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupId = \App\Fields\Owner::getGroupId($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationModel->addRelation($recordModel->getId(), $newRecordModel->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('fieldname' === $fieldValueType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $sourceModuleName === $entityType ? $fieldValue = $recordModel->get($fieldValue) : $fieldValue = $parentRecordModel->get($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/expression_engine/include.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $exprEvaluater->evaluate($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $match[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupId = \App\Fields\Owner::getGroupId($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strpos($destinyModuleName, 'destinyModule') > 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
$moduleName = $recordModel->getModuleName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceModuleName = $destinyModuleName ?? $fieldInfo['modulename'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$expression = $parser->expression();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $newRecordModel->getField($fieldName)->getUITypeModel()->getDBValue($fieldValue);
- Exclude checks
Spaces must 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 true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = App\User::getUserIdByName($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldValueMapping as $fieldInfo) {
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$fieldValue = $sourceModuleName === $entityType ? $newRecordModel->get($fieldValue) : $fieldValue = $recordModel->get($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (preg_match('/([^:]+):boolean$/', $fieldValue, $match)) {
- 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
} elseif ('expression' == $fieldValueType) {
- 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
$ownerFields = array_keys($newRecordModel->getModule()->getFieldsByType('owner'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = '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
$newRecordModel->setRecordFieldValues($parentRecordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($saveContinue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$entityType = $this->entity_type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->relationId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $recordModel->getField($fieldName)->getUITypeModel()->getDBValue($fieldValue);
- Exclude checks
Spaces must 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 getDestinyModuleName(string $destinyModuleName): ?string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $recordModel->getId();
- 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
if (!empty($this->field_value_mapping)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->relationId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('triggerUser' === $fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!is_numeric($fieldValue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->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
$parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerFields[] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $fieldInfo['fieldname'];
- 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 (!$userId && !$groupId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = (!$userId) ? $groupId : $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = '1';
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
$relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);
- Exclude checks
Line exceeds 120 characters; contains 207 characters Open
if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$saveContinue = 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
Spaces must be used to indent lines; tabs are not allowed Open
return $moduleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $executeImmediately = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFieldNames()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValueMapping = \App\Json::decode($this->field_value_mapping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $sourceModuleName === $entityType ? $newRecordModel->get($fieldValue) : $fieldValue = $recordModel->get($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('expression' === $fieldValueType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $match[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// To handle cyclic process
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($this->mappingPanel && $entityType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($fieldValueMapping) && \is_array($fieldValueMapping)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($mandatoryFields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $destinyModuleName ? $parentRecordModel->get($fieldValue) : $recordModel->get($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($sourceModuleName === $entityType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('true' == $fieldValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get destiny module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['entity_type', 'reference_field', 'field_value_mapping', 'mappingPanel', 'verifyIfExists', 'relationId'];
- 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 (!\App\Module::isModuleActive($entityType)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->mappingPanel && !empty($entityType) && !empty($fieldValueMapping) && \count($fieldValueMapping) > 0) {
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
if (!$this->mappingPanel && !empty($entityType) && !empty($fieldValueMapping) && \count($fieldValueMapping) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $fieldInfo['fieldname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $destinyModuleName ? $newRecordModel->get($fieldValue) : $recordModel->get($fieldValue);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$fieldValue = $destinyModuleName ? $newRecordModel->get($fieldValue) : $recordModel->get($fieldValue);
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $exprEvaluater->evaluate($newRecordModel);
- 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
$newRecordModel->set($this->reference_field, $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newRecordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$saveContinue = true;
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
if ('' === $newRecordModel->get($field->getName()) || null === $newRecordModel->get($field->getName())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceModuleName = $destinyModuleName ?? $fieldInfo['modulename'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($fieldName, $ownerFields) && !is_numeric($fieldValue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = App\User::getUserIdByName($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = $recordModel->get($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
return $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/expression_engine/include.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$exprEvaluater = new VTFieldExpressionEvaluater($expression);
- Exclude checks
Spaces must 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 (!\in_array($fieldName, $ownerFields)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($fieldName, $ownerFields)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = trim($fieldInfo['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
$parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$expression = $parser->expression();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('owner' === $fieldModel->getFieldDataType()) {
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
return ['entity_type', 'reference_field', 'field_value_mapping', 'mappingPanel', 'verifyIfExists', 'relationId'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Execute task.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValue = (!$userId) ? $groupId : $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldValueType = $fieldInfo['valuetype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$destinyModuleName = $this->getDestinyModuleName($fieldInfo['modulename']);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$fieldValue = $destinyModuleName ? $parentRecordModel->get($fieldValue) : $recordModel->get($fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!\in_array($fieldName, $ownerFields)) {
- Exclude checks
Spaces must 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->set($fieldName, $fieldValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks