Function process
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
- 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 process
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
The method process() has an NPath complexity of 107136. The configured NPath complexity threshold is 200. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method process() has 144 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
- Exclude checks
The method process() has a Cyclomatic Complexity of 29. The configured cyclomatic complexity threshold is 10. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
- 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 63 to the 15 allowed. Open
public function process(App\Request $request)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The class Settings_Workflows_EditTask_View has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13. Open
class Settings_Workflows_EditTask_View extends Settings_Vtiger_Index_View
{
/** {@inheritdoc} */
public function checkPermission(App\Request $request)
{
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '19', column '14'). Open
throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Language' in method 'process'. Open
$blockName = \App\Language::translate($blockName, $sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$fromEmailFieldOptions = array_merge(['' => ['' => \App\Language::translate('Optional', $qualifiedModuleName)]], $emailFieldoptions);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Workflows_TaskRecord_Model' in method 'process'. Open
$taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($workflowModel, $taskType);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Groups_Record_Model' in method 'process'. Open
$groupRecordModel = Settings_Groups_Record_Model::getInstance($mappingInfo['value']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Field' in method 'process'. Open
$relations = \App\Field::getRelatedFieldForModule($sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$relationsEmails['OSSMailView::from_email::first'] = \App\Language::translate('OSSMailView', 'OSSMailView') . ' - ' . \App\Language::translate('From', 'OSSMailView') . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$label = $relationsEmails[$relation->get('relatedModuleName') . '::' . $key] = \App\Language::translate($relation->get('relatedModuleName'), $relation->get('relatedModuleName')) . ' - ' . \App\Language::translate($field->getFieldLabel(), $relation->get('relatedModuleName'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$relationsEmails['OSSMailView::from_email::first'] = \App\Language::translate('OSSMailView', 'OSSMailView') . ' - ' . \App\Language::translate('From', 'OSSMailView') . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- 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_Loader' in method 'process'. Open
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $sourceModule);
- 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 'process'. Open
$fieldMapping = \App\Json::decode($taskObject->field_value_mapping);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'process'. Open
$recordStructureModulesField[$relatedModuleName][$referenceField->getFieldName()] = Vtiger_RecordStructure_Model::getInstanceForModule(Vtiger_Module_Model::getInstance($relatedModuleName))->getStructure();
- 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 'process'. Open
$userModel = \App\User::getCurrentUserModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$relationsEmails[$relation->get('relatedModuleName') . '::' . $key . '::first'] = $label . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- 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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$groupRecordModel = Settings_Groups_Record_Model::getInstance($mappingInfo['value']);
$ownerName = $groupRecordModel->getId();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Language' in method 'process'. Open
$relationsEmails['OSSMailView::from_email::first'] = \App\Language::translate('OSSMailView', 'OSSMailView') . ' - ' . \App\Language::translate('From', 'OSSMailView') . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Workflows_Module_Model' in method 'process'. Open
$viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Workflows_TaskRecord_Model' in method 'process'. Open
$taskModel = Settings_Workflows_TaskRecord_Model::getInstance($recordId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\TextParser' in method 'process'. Open
$textParser = App\TextParser::getInstance($sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Workflows_Record_Model' in method 'process'. Open
$workflowModel = Settings_Workflows_Record_Model::getInstance($workflowId);
- 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 'process'. Open
$taskObject->field_value_mapping = \App\Json::encode($fieldMapping);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Relation_Model' in method 'process'. Open
$documentsRelations = Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($relatedModuleName), $documentsModel);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$blockName = \App\Language::translate($blockName, $sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
\App\Language::translate('LBL_USERS') => \App\Fields\Owner::getInstance()->getAccessibleUsers(),
- 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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$taskType = $request->getByType('type', 'Alnum');
$taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($workflowModel, $taskType);
}
- 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_Relation_Model' in method 'process'. Open
$documentsRelations = Vtiger_Relation_Model::getInstance($moduleModel, $documentsModel);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'process'. Open
$documentsRelations = Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($relatedModuleName), $documentsModel);
- 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_Field_Model' in method 'process'. Open
$relationsWithDocuments[$info['fieldname']][$info['relmod']] = Vtiger_Field_Model::getInstance($info['fieldid']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Users_Record_Model' in method 'process'. Open
$userRecordModel = Users_Record_Model::getInstanceByName($mappingInfo['value']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'process'. Open
$documentsModel = Vtiger_Module_Model::getInstance('Documents');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
\App\Language::translate('LBL_GROUPS') => \App\Fields\Owner::getInstance()->getAccessibleGroups(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'process'. Open
$relationModuleModel = Vtiger_Module_Model::getInstance($taskObject->entity_type);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$label = $relationsEmails[$relation->get('relatedModuleName') . '::' . $key] = \App\Language::translate($relation->get('relatedModuleName'), $relation->get('relatedModuleName')) . ' - ' . \App\Language::translate($field->getFieldLabel(), $relation->get('relatedModuleName'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Language' in method 'process'. Open
$emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);
- 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" 3 times. Open
if (\array_key_exists($mappingInfo['fieldname'], $ownerFieldModels)) {
- 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 "email" 3 times. Open
foreach ($relation->getRelationModuleModel()->getFieldsByType('email') as $key => $field) {
- 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 "Documents" 3 times. Open
if ('Documents' === $sourceModule) {
- 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 "task_id" 3 times. Open
if (!$request->isEmpty('task_id') && !Settings_Workflows_TaskRecord_Model::getInstance($request->getInteger('task_id'))->isEditable()) {
- 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 "relatedModuleName" 7 times. Open
if (!\in_array($relation->get('relatedModuleName'), [$sourceModule, 'Documents', 'OSSMailView'])) {
- 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 "value" 5 times. Open
if ('assigned_user_id' == $mappingInfo['value']) {
- 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 "OSSMailView" 5 times. Open
if (!\in_array($relation->get('relatedModuleName'), [$sourceModule, 'Documents', 'OSSMailView'])) {
- 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 undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TASK_OBJECT', $taskObject);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TEMPLATES_MAPPING', $mfModel->getTemplatesByModule($sourceModule));
- Exclude checks
Argument 2 (value)
is ''
but \App\Request::getInteger()
takes int
defined at /code/app/Request.php:200
Open
$recordId = $request->getInteger('task_id', '');
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TASK_TYPE_MODEL', $taskTypeModel);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RECORD_STRUCTURE', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel)->getStructure());
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TASK_TEMPLATE_PATH', $taskTypeModel->getTemplatePath());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RECORD_STRUCTURE_RELATED_MODULES', $recordStructureModulesField);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('WORKFLOW_ID', $workflowId);
- Exclude checks
Call to undeclared method \VTTask::getTaskType
Open
$taskTypeModel = $taskModel->getTaskType();
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
\App\Language::translate('LBL_GROUPS') => \App\Fields\Owner::getInstance()->getAccessibleGroups(),
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ASSIGNED_TO', $assignedToValues);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('EMAIL_FIELD_OPTION', $emailFieldoptions);
- Exclude checks
Call to undeclared method \VTTask::isEditable
Open
if (!$request->isEmpty('task_id') && !Settings_Workflows_TaskRecord_Model::getInstance($request->getInteger('task_id'))->isEditable()) {
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TASK_MODEL', $taskModel);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('timeFormat', $userModel->getDetail('hour_format'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('REFERENCE_FIELD_NAME', $taskObject->reference_field ?? '');
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DOCUMENTS_RELATED_MODULLES', $relationsWithDocuments);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('CURRENTDATE', date('Y-n-j'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RESTRICTFIELDS', $restrictFields);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ADVANCE_CRITERIA', $taskObject->conditions ?? []);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DOCUMENTS_MODULLES', $documents);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DATETIME_FIELDS', $dateTimeFields);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('WORKFLOW_MODEL', $workflowModel);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('FROM_EMAIL_FIELD_OPTION', $fromEmailFieldOptions);
- Exclude checks
Call to undeclared method \VTTask::getTaskObject
Open
$taskObject = $taskModel->getTaskObject();
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('dateFormat', $userModel->getDetail('date_format'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE', $moduleName);
- Exclude checks
Call to method getInstance
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$textParser = App\TextParser::getInstance($sourceModule);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SOURCE_MODULE', $sourceModule);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TASK_ID', $recordId);
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
\App\Language::translate('LBL_USERS') => \App\Fields\Owner::getInstance()->getAccessibleUsers(),
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RELATED_RECORDS_EMAIL', $relationsEmails);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TEXT_PARSER', $textParser);
- Exclude checks
Avoid excessively long variable names like $recordStructureModulesField. Keep variable name length under 20. Open
$recordStructureModulesField = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $relationsWithDocuments. Keep variable name length under 20. Open
$relationsWithDocuments = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $fromEmailFieldOptions. Keep variable name length under 20. Open
$fromEmailFieldOptions = array_merge(['' => ['' => \App\Language::translate('Optional', $qualifiedModuleName)]], $emailFieldoptions);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Workflows_EditTask_View extends Settings_Vtiger_Index_View
- Exclude checks
The class Settings_Workflows_EditTask_View is not named in CamelCase. Open
class Settings_Workflows_EditTask_View extends Settings_Vtiger_Index_View
{
/** {@inheritdoc} */
public function checkPermission(App\Request $request)
{
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkPermission(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qualifiedModuleName = $request->getModule(false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflowId = $request->getInteger('for_workflow');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::checkPermission($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $request->getInteger('task_id', '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskTypeModel = $taskModel->getTaskType();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\array_key_exists($mappingInfo['fieldname'], $ownerFieldModels)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$request->isEmpty('task_id') && !Settings_Workflows_TaskRecord_Model::getInstance($request->getInteger('task_id'))->isEditable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Documents' === $sourceModule) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerName = $userRecordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RECORD_STRUCTURE', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel)->getStructure());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('SumFieldFromDependent' === $taskType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$documents = true;
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$viewer->assign('RECORD_STRUCTURE', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel)->getStructure());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationsWithDocuments = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DOCUMENTS_RELATED_MODULLES', $relationsWithDocuments);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 201 characters Open
$relationsEmails[$relation->get('relatedModuleName') . '::' . $key . '::first'] = $label . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TASK_ID', $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('WORKFLOW_MODEL', $workflowModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockName = \App\Language::translate($blockName, $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($textParser->getRelatedVariable('email') as $modules) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
if (!$request->isEmpty('task_id') && !Settings_Workflows_TaskRecord_Model::getInstance($request->getInteger('task_id'))->isEditable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflowModel = Settings_Workflows_Record_Model::getInstance($workflowId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerFieldModels = $relationModuleModel->getFieldsByType('owner');
- Exclude checks
Spaces must 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 ('VTUpdateFieldsTask' === $taskType || 'VTUpdateRelatedFieldTask' === $taskType) {
- Exclude checks
Line exceeds 120 characters; contains 225 characters Open
$recordStructureModulesField[$relatedModuleName][$referenceField->getFieldName()] = Vtiger_RecordStructure_Model::getInstanceForModule(Vtiger_Module_Model::getInstance($relatedModuleName))->getStructure();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationsWithDocuments[$info['fieldname']][$info['relmod']] = Vtiger_Field_Model::getInstance($info['fieldid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('OSSMailView' === $relation->get('relatedModuleName')) {
- Exclude checks
Spaces must 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
$viewer->assign('MODULE_MODEL', $moduleModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DATETIME_FIELDS', $dateTimeFields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TASK_MODEL', $taskModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ASSIGNED_TO', $assignedToValues);
- Exclude checks
Spaces must 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
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModel->getFieldsByReference() as $referenceField) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = $relationsEmails[$relation->get('relatedModuleName') . '::' . $key] = \App\Language::translate($relation->get('relatedModuleName'), $relation->get('relatedModuleName')) . ' - ' . \App\Language::translate($field->getFieldLabel(), $relation->get('relatedModuleName'));
- Exclude checks
Line exceeds 120 characters; contains 299 characters Open
$label = $relationsEmails[$relation->get('relatedModuleName') . '::' . $key] = \App\Language::translate($relation->get('relatedModuleName'), $relation->get('relatedModuleName')) . ' - ' . \App\Language::translate($field->getFieldLabel(), $relation->get('relatedModuleName'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fromEmailFieldOptions = array_merge(['' => ['' => \App\Language::translate('Optional', $qualifiedModuleName)]], $emailFieldoptions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('VTCreateEntityTask' === $taskType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldMapping[$key]['valuetype'] = 'fieldname';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupRecordModel = Settings_Groups_Record_Model::getInstance($mappingInfo['value']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$restrictFields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
- Exclude checks
Spaces must 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
$taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($workflowModel, $taskType);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskObject = $taskModel->getTaskObject();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TEMPLATES_MAPPING', $mfModel->getTemplatesByModule($sourceModule));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$documentsRelations = Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($relatedModuleName), $documentsModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldMapping = \App\Json::decode($taskObject->field_value_mapping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userRecordModel = Users_Record_Model::getInstanceByName($mappingInfo['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
$restrictFields = ['folderid', 'filename', 'filelocationtype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordStructureModulesField[$relatedModuleName][$referenceField->getFieldName()] = Vtiger_RecordStructure_Model::getInstanceForModule(Vtiger_Module_Model::getInstance($relatedModuleName))->getStructure();
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$relationsWithDocuments[$info['fieldname']][$info['relmod']] = Vtiger_Field_Model::getInstance($info['fieldid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DOCUMENTS_MODULLES', $documents);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationsEmails = [];
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskType = $request->getByType('type', 'Alnum');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TASK_TEMPLATE_PATH', $taskTypeModel->getTemplatePath());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('triggerUser' !== $mappingInfo['value']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldMapping[$key]['value'] = $ownerName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($referenceField->getReferenceList() as $relatedModuleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $documentsRelations) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($relation->get('relatedModuleName'), [$sourceModule, 'Documents', 'OSSMailView'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('MODULE', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationModuleModel = Vtiger_Module_Model::getInstance($taskObject->entity_type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskObject->field_value_mapping = \App\Json::encode($fieldMapping);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationsEmails[$relation->get('relatedModuleName') . '::' . $key . '::first'] = $label . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
$fromEmailFieldOptions = array_merge(['' => ['' => \App\Language::translate('Optional', $qualifiedModuleName)]], $emailFieldoptions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('EditTask.tpl', $qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TASK_TYPE_MODEL', $taskTypeModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerName = $groupRecordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TASK_OBJECT', $taskObject);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emailFieldoptions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Language::translate('LBL_GROUPS') => \App\Fields\Owner::getInstance()->getAccessibleGroups(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceModule = $moduleModel->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTimeFields = $moduleModel->getFieldsByType(['date', 'datetime']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mfModel = new $handlerClass();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userRecordModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RECORD_STRUCTURE_RELATED_MODULES', $recordStructureModulesField);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('VTEmailTemplateTask' === $taskType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('WORKFLOW_ID', $workflowId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($textParser->getRecordVariable('email') as $blockName => $fields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('TEXT_PARSER', $textParser);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('FROM_EMAIL_FIELD_OPTION', $fromEmailFieldOptions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('REFERENCE_FIELD_NAME', $taskObject->reference_field ?? '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fieldMapping as $key => $mappingInfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordStructureModulesField = [];
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
$documentsRelations = Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($relatedModuleName), $documentsModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 274 characters Open
$relationsEmails['OSSMailView::from_email::first'] = \App\Language::translate('OSSMailView', 'OSSMailView') . ' - ' . \App\Language::translate('From', 'OSSMailView') . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SOURCE_MODULE', $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockName = \App\Language::translate($blockName, $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Language::translate('LBL_USERS') => \App\Fields\Owner::getInstance()->getAccessibleUsers(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($taskObject->entity_type) && $taskObject->field_value_mapping) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('assigned_user_id' == $mappingInfo['value']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RESTRICTFIELDS', $restrictFields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RELATED_RECORDS_EMAIL', $relationsEmails);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('CURRENTDATE', date('Y-n-j'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('timeFormat', $userModel->getDetail('hour_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$assignedToValues = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = $workflowModel->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relations as $relatedModuleName => $info) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $documentsRelations) {
- Exclude checks
Spaces must 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 ($relation->getRelationModuleModel()->getFieldsByType('email') as $key => $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modules as $blockName => $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ADVANCE_CRITERIA', $taskObject->conditions ?? []);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relations = \App\Field::getRelatedFieldForModule($sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$documentsModel = Vtiger_Module_Model::getInstance('Documents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$documents = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationsEmails['OSSMailView::from_email::first'] = \App\Language::translate('OSSMailView', 'OSSMailView') . ' - ' . \App\Language::translate('From', 'OSSMailView') . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('EMAIL_FIELD_OPTION', $emailFieldoptions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskModel = Settings_Workflows_TaskRecord_Model::getInstance($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskType = \get_class($taskObject);
- 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
$documentsRelations = Vtiger_Relation_Model::getInstance($moduleModel, $documentsModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleModel->getRelations() as $relation) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('dateFormat', $userModel->getDetail('date_format'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textParser = App\TextParser::getInstance($sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "Settings_Workflows_EditTask_View" is not in camel caps format Open
class Settings_Workflows_EditTask_View extends Settings_Vtiger_Index_View
- Exclude checks