YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Workflows/views/EditTask.php

Summary

Maintainability
D
1 day
Test Coverage
F
0%

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);
Severity: Minor
Found in modules/Settings/Workflows/views/EditTask.php - About 1 day to fix

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);
Severity: Major
Found in modules/Settings/Workflows/views/EditTask.php - About 5 hrs to fix

    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);

    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);

    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);

    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)

    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)
        {

    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');

    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);

    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);

    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);

    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']);

    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);

    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) . ']';

    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'));

    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) . ']';

    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);

    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);

    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();

    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();

    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) . ']';

    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();
                                }

    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) . ']';

    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());

    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);

    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);

    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);

    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);

    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);

    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);

    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(),

    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);
            }

    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);

    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);

    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']);

    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);

    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']);

    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');

    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(),

    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);

    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'));

    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);

    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)) {

    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) {

    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) {

    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()) {

    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'])) {

    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']) {

    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'])) {

    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);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('TEMPLATES_MAPPING', $mfModel->getTemplatesByModule($sourceModule));

    Argument 2 (value) is '' but \App\Request::getInteger() takes int defined at /code/app/Request.php:200
    Open

            $recordId = $request->getInteger('task_id', '');

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TASK_TYPE_MODEL', $taskTypeModel);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RECORD_STRUCTURE', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel)->getStructure());

    Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

            $userModel = \App\User::getCurrentUserModel();

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TASK_TEMPLATE_PATH', $taskTypeModel->getTemplatePath());

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_MODEL', $moduleModel);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RECORD_STRUCTURE_RELATED_MODULES', $recordStructureModulesField);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('WORKFLOW_ID', $workflowId);

    Call to undeclared method \VTTask::getTaskType
    Open

            $taskTypeModel = $taskModel->getTaskType();

    Call to method getInstance from undeclared class \App\Fields\Owner
    Open

                \App\Language::translate('LBL_GROUPS') => \App\Fields\Owner::getInstance()->getAccessibleGroups(),

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ASSIGNED_TO', $assignedToValues);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('EMAIL_FIELD_OPTION', $emailFieldoptions);

    Call to undeclared method \VTTask::isEditable
    Open

            if (!$request->isEmpty('task_id') && !Settings_Workflows_TaskRecord_Model::getInstance($request->getInteger('task_id'))->isEditable()) {

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TASK_MODEL', $taskModel);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('timeFormat', $userModel->getDetail('hour_format'));

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('REFERENCE_FIELD_NAME', $taskObject->reference_field ?? '');

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('DOCUMENTS_RELATED_MODULLES', $relationsWithDocuments);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('CURRENTDATE', date('Y-n-j'));

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RESTRICTFIELDS', $restrictFields);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('ADVANCE_CRITERIA', $taskObject->conditions ?? []);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('DOCUMENTS_MODULLES', $documents);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('DATETIME_FIELDS', $dateTimeFields);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('WORKFLOW_MODEL', $workflowModel);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FROM_EMAIL_FIELD_OPTION', $fromEmailFieldOptions);

    Call to undeclared method \VTTask::getTaskObject
    Open

            $taskObject = $taskModel->getTaskObject();

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('dateFormat', $userModel->getDetail('date_format'));

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE', $moduleName);

    Call to method getInstance from undeclared class \App\TextParser (Did you mean class \Tests\App\TextParser)
    Open

            $textParser = App\TextParser::getInstance($sourceModule);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SOURCE_MODULE', $sourceModule);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TASK_ID', $recordId);

    Call to method getInstance from undeclared class \App\Fields\Owner
    Open

                \App\Language::translate('LBL_USERS') => \App\Fields\Owner::getInstance()->getAccessibleUsers(),

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RELATED_RECORDS_EMAIL', $relationsEmails);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TEXT_PARSER', $textParser);

    Avoid excessively long variable names like $recordStructureModulesField. Keep variable name length under 20.
    Open

                $recordStructureModulesField = [];

    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 = [];

    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);

    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

    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)
        {

    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');

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function checkPermission(App\Request $request)

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function process(App\Request $request)

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $qualifiedModuleName = $request->getModule(false);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $workflowId = $request->getInteger('for_workflow');

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /** {@inheritdoc} */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            parent::checkPermission($request);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $recordId = $request->getInteger('task_id', '');

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $moduleName = $request->getModule();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ($recordId) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $taskTypeModel = $taskModel->getTaskType();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        if (\array_key_exists($mappingInfo['fieldname'], $ownerFieldModels)) {

    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()) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if ('Documents' === $sourceModule) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                    $ownerName = $userRecordModel->getId();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('RECORD_STRUCTURE', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel)->getStructure());

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('SumFieldFromDependent' === $taskType) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $documents = true;

    Line exceeds 120 characters; contains 130 characters
    Open

                $viewer->assign('RECORD_STRUCTURE', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel)->getStructure());

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $relationsWithDocuments = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('DOCUMENTS_RELATED_MODULLES', $relationsWithDocuments);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Line exceeds 120 characters; contains 201 characters
    Open

                            $relationsEmails[$relation->get('relatedModuleName') . '::' . $key . '::first'] = $label . ' [' . \App\Language::translate('LBL_ONLY_TO_FIRST_LIST', $qualifiedModuleName) . ']';

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('TASK_ID', $recordId);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('WORKFLOW_MODEL', $workflowModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $blockName = \App\Language::translate($blockName, $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($textParser->getRelatedVariable('email') as $modules) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Line exceeds 120 characters; contains 144 characters
    Open

            if (!$request->isEmpty('task_id') && !Settings_Workflows_TaskRecord_Model::getInstance($request->getInteger('task_id'))->isEditable()) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $workflowModel = Settings_Workflows_Record_Model::getInstance($workflowId);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $ownerFieldModels = $relationModuleModel->getFieldsByType('owner');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('VTUpdateFieldsTask' === $taskType || 'VTUpdateRelatedFieldTask' === $taskType) {

    Line exceeds 120 characters; contains 225 characters
    Open

                        $recordStructureModulesField[$relatedModuleName][$referenceField->getFieldName()] = Vtiger_RecordStructure_Model::getInstanceForModule(Vtiger_Module_Model::getInstance($relatedModuleName))->getStructure();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $relationsWithDocuments[$info['fieldname']][$info['relmod']] = Vtiger_Field_Model::getInstance($info['fieldid']);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    } elseif ('OSSMailView' === $relation->get('relatedModuleName')) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('MODULE_MODEL', $moduleModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('DATETIME_FIELDS', $dateTimeFields);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('TASK_MODEL', $taskModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('ASSIGNED_TO', $assignedToValues);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } else {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach ($moduleModel->getFieldsByReference() as $referenceField) {

    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'));

    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'));

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $fromEmailFieldOptions = array_merge(['' => ['' => \App\Language::translate('Optional', $qualifiedModuleName)]], $emailFieldoptions);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer = $this->getViewer($request);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('VTCreateEntityTask' === $taskType) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                $fieldMapping[$key]['valuetype'] = 'fieldname';

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                    $groupRecordModel = Settings_Groups_Record_Model::getInstance($mappingInfo['value']);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $restrictFields = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($workflowModel, $taskType);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $taskObject = $taskModel->getTaskObject();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('TEMPLATES_MAPPING', $mfModel->getTemplatesByModule($sourceModule));

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $documentsRelations = Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($relatedModuleName), $documentsModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $fieldMapping = \App\Json::decode($taskObject->field_value_mapping);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                $userRecordModel = Users_Record_Model::getInstanceByName($mappingInfo['value']);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $restrictFields = ['folderid', 'filename', 'filelocationtype'];

    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();

    Line exceeds 120 characters; contains 133 characters
    Open

                        $relationsWithDocuments[$info['fieldname']][$info['relmod']] = Vtiger_Field_Model::getInstance($info['fieldid']);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('DOCUMENTS_MODULLES', $documents);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $relationsEmails = [];

    Line exceeds 120 characters; contains 131 characters
    Open

                        $emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $taskType = $request->getByType('type', 'Alnum');

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('TASK_TEMPLATE_PATH', $taskTypeModel->getTemplatePath());

    Spaces must be used to indent lines; tabs are not allowed
    Open

                            } elseif ('triggerUser' !== $mappingInfo['value']) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                $fieldMapping[$key]['value'] = $ownerName;

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    foreach ($referenceField->getReferenceList() as $relatedModuleName) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (false !== $documentsRelations) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if (!\in_array($relation->get('relatedModuleName'), [$sourceModule, 'Documents', 'OSSMailView'])) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('MODULE', $moduleName);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach ($fields as $field) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $relationModuleModel = Vtiger_Module_Model::getInstance($taskObject->entity_type);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $taskObject->field_value_mapping = \App\Json::encode($fieldMapping);

    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) . ']';

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        }

    Line exceeds 120 characters; contains 127 characters
    Open

                    $emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    foreach ($fields as $field) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        $emailFieldoptions[$blockName][$field['var_value']] = \App\Language::translate($field['label'], $sourceModule);

    Line exceeds 120 characters; contains 141 characters
    Open

            $fromEmailFieldOptions = array_merge(['' => ['' => \App\Language::translate('Optional', $qualifiedModuleName)]], $emailFieldoptions);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->view('EditTask.tpl', $qualifiedModuleName);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('TASK_TYPE_MODEL', $taskTypeModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                    $ownerName = $groupRecordModel->getId();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('TASK_OBJECT', $taskObject);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $emailFieldoptions = [];

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Language::translate('LBL_GROUPS') => \App\Fields\Owner::getInstance()->getAccessibleGroups(),

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $sourceModule = $moduleModel->getName();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $dateTimeFields = $moduleModel->getFieldsByType(['date', 'datetime']);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $mfModel = new $handlerClass();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                if ($userRecordModel) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('RECORD_STRUCTURE_RELATED_MODULES', $recordStructureModulesField);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('VTEmailTemplateTask' === $taskType) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('WORKFLOW_ID', $workflowId);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            foreach ($textParser->getRecordVariable('email') as $blockName => $fields) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('TEXT_PARSER', $textParser);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('FROM_EMAIL_FIELD_OPTION', $fromEmailFieldOptions);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('REFERENCE_FIELD_NAME', $taskObject->reference_field ?? '');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    foreach ($fieldMapping as $key => $mappingInfo) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $recordStructureModulesField = [];

    Line exceeds 120 characters; contains 144 characters
    Open

                    $documentsRelations = Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($relatedModuleName), $documentsModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }

    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) . ']';

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('SOURCE_MODULE', $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $blockName = \App\Language::translate($blockName, $sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Language::translate('LBL_USERS') => \App\Fields\Owner::getInstance()->getAccessibleUsers(),

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (!empty($taskObject->entity_type) && $taskObject->field_value_mapping) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                            if ('assigned_user_id' == $mappingInfo['value']) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('RESTRICTFIELDS', $restrictFields);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('RELATED_RECORDS_EMAIL', $relationsEmails);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('CURRENTDATE', date('Y-n-j'));

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('timeFormat', $userModel->getDetail('hour_format'));

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $assignedToValues = [

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $moduleModel = $workflowModel->getModule();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach ($relations as $relatedModuleName => $info) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    if (false !== $documentsRelations) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        foreach ($relation->getRelationModuleModel()->getFieldsByType('email') as $key => $field) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach ($modules as $blockName => $fields) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ];

    Spaces must be used to indent lines; tabs are not allowed
    Open

                        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $viewer->assign('ADVANCE_CRITERIA', $taskObject->conditions ?? []);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $relations = \App\Field::getRelatedFieldForModule($sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $documentsModel = Vtiger_Module_Model::getInstance('Documents');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $documents = false;

    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) . ']';

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('EMAIL_FIELD_OPTION', $emailFieldoptions);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $taskModel = Settings_Workflows_TaskRecord_Model::getInstance($recordId);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $taskType = \get_class($taskObject);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                } else {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                                }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $documentsRelations = Vtiger_Relation_Model::getInstance($moduleModel, $documentsModel);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                foreach ($moduleModel->getRelations() as $relation) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $userModel = \App\User::getCurrentUserModel();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $viewer->assign('dateFormat', $userModel->getDetail('date_format'));

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $textParser = App\TextParser::getInstance($sourceModule);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    }

    Class name "Settings_Workflows_EditTask_View" is not in camel caps format
    Open

    class Settings_Workflows_EditTask_View extends Settings_Vtiger_Index_View

    There are no issues that match your filters.

    Category
    Status