YetiForceCompany/YetiForceCRM

View on GitHub
modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Function doTask has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    public function doTask($recordModel)
    {
        $moduleName = $recordModel->getModuleName();
        $recordId = $recordModel->getId();
        $entityType = $this->entity_type;
Severity: Minor
Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.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

Function setFieldMapping has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
    {
        $ownerFields = [];
        $entityType = $this->entity_type;
        foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
Severity: Minor
Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php - About 4 hrs 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 doTask has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function doTask($recordModel)
    {
        $moduleName = $recordModel->getModuleName();
        $recordId = $recordModel->getId();
        $entityType = $this->entity_type;
Severity: Major
Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php - About 3 hrs to fix

    The class VTCreateEntityTask has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
    Open

    class VTCreateEntityTask extends VTTask
    {
        public $executeImmediately = true;
    
        public function getFieldNames()

    Method setFieldMapping has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
        {
            $ownerFields = [];
            $entityType = $this->entity_type;
            foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {
    Severity: Major
    Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php - About 2 hrs to fix

      The method doTask() has an NPath complexity of 972. The configured NPath complexity threshold is 200.
      Open

          public function doTask($recordModel)
          {
              $moduleName = $recordModel->getModuleName();
              $recordId = $recordModel->getId();
              $entityType = $this->entity_type;

      NPathComplexity

      Since: 0.1

      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

      Example

      class Foo {
          function bar() {
              // lots of complicated code
          }
      }

      Source https://phpmd.org/rules/codesize.html#npathcomplexity

      The method doTask() has a Cyclomatic Complexity of 35. The configured cyclomatic complexity threshold is 10.
      Open

          public function doTask($recordModel)
          {
              $moduleName = $recordModel->getModuleName();
              $recordId = $recordModel->getId();
              $entityType = $this->entity_type;

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

      The method setFieldMapping() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
      Open

          public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)
          {
              $ownerFields = [];
              $entityType = $this->entity_type;
              foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

      Refactor this function to reduce its Cognitive Complexity from 76 to the 15 allowed.
      Open

          public function doTask($recordModel)

      Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

      See

      Refactor this function to reduce its Cognitive Complexity from 41 to the 15 allowed.
      Open

          public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)

      Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

      See

      Missing class import via use statement (line '57', column '71').
      Open

                          $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '148', column '26').
      Open

                      $exprEvaluater = new VTFieldExpressionEvaluater($expression);

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '146', column '19').
      Open

                      $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '146', column '42').
      Open

                      $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '146', column '70').
      Open

                      $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '57', column '20').
      Open

                          $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '57', column '43').
      Open

                          $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '59', column '27').
      Open

                          $exprEvaluater = new VTFieldExpressionEvaluater($expression);

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Avoid using static access to class 'App\User' in method 'setFieldMapping'.
      Open

                      $userId = App\User::getUserIdByName($fieldValue);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class '\App\Json' in method 'doTask'.
      Open

                  $fieldValueMapping = \App\Json::decode($this->field_value_mapping);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                          } else {
                              $fieldValue = $sourceModuleName === $entityType ? $newRecordModel->get($fieldValue) : $fieldValue = $recordModel->get($fieldValue);
                          }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class 'Vtiger_Record_Model' in method 'doTask'.
      Open

                  $newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                              } else {
                                  $fieldValue = (!$userId) ? $groupId : $userId;
                              }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class '\App\Fields\Owner' in method 'setFieldMapping'.
      Open

                      $groupId = \App\Fields\Owner::getGroupId($fieldValue);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $fieldValue = $exprEvaluater->evaluate($parentRecordModel);
                      }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                          } else {
                              $fieldValue = $exprEvaluater->evaluate($recordModel);
                          }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class '\App\Fields\Owner' in method 'doTask'.
      Open

                              $groupId = \App\Fields\Owner::getGroupId($fieldValue);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class 'Vtiger_Record_Model' in method 'doTask'.
      Open

                  $newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class '\Vtiger_Relation_Model' in method 'doTask'.
      Open

                  $relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class '\App\Module' in method 'doTask'.
      Open

              if (!\App\Module::isModuleActive($entityType)) {

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class 'App\User' in method 'doTask'.
      Open

                              $userId = App\User::getUserIdByName($fieldValue);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $fieldValue = 0;
                      }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $fieldValue = $sourceModuleName === $entityType ? $fieldValue = $recordModel->get($fieldValue) : $fieldValue = $parentRecordModel->get($fieldValue);
                      }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method doTask uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                          } else {
                              $fieldValue = '0';
                          }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid assigning values to variables in if clauses and the like (line '100', column '42').
      Open

          public function doTask($recordModel)
          {
              $moduleName = $recordModel->getModuleName();
              $recordId = $recordModel->getId();
              $entityType = $this->entity_type;

      IfStatementAssignment

      Since: 2.7.0

      Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($foo = 'bar') { // possible typo
                  // ...
              }
              if ($baz = 0) { // always false
                  // ...
              }
          }
      }

      Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

      Avoid using static access to class 'Vtiger_Record_Model' in method 'doTask'.
      Open

                  $parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method setFieldMapping uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $fieldValue = (!$userId) ? $groupId : $userId;
                      }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class 'Vtiger_RelationListView_Model' in method 'doTask'.
      Open

                  if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Define a constant instead of duplicating this literal "fieldname" 4 times.
      Open

                      $fieldName = $fieldInfo['fieldname'];

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "modulename" 4 times.
      Open

                      $destinyModuleName = $this->getDestinyModuleName($fieldInfo['modulename']);

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Reference to undeclared property \VTCreateEntityTask->entity_type
      Open

              $entityType = $this->entity_type;

      Reference to undeclared property \VTCreateEntityTask->relationId
      Open

                          if ($this->relationId) {

      Reference to undeclared property \VTCreateEntityTask->reference_field
      Open

                  $newRecordModel->set($this->reference_field, $recordId);

      Reference to undeclared property \VTCreateEntityTask->relationId
      Open

                      if ($this->relationId) {

      Reference to undeclared property \VTCreateEntityTask->mappingPanel
      Open

              } elseif ($this->mappingPanel && $entityType) {

      Reference to undeclared property \VTCreateEntityTask->verifyIfExists
      Open

                  if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {

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

                      $groupId = \App\Fields\Owner::getGroupId($fieldValue);

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

                              $groupId = \App\Fields\Owner::getGroupId($fieldValue);

      Reference to undeclared property \VTCreateEntityTask->mappingPanel
      Open

              if (!$this->mappingPanel && !empty($entityType) && !empty($fieldValueMapping) && \count($fieldValueMapping) > 0) {

      Reference to undeclared property \VTCreateEntityTask->field_value_mapping (Did you mean $fieldValueMapping)
      Open

              if (!empty($this->field_value_mapping)) {

      Reference to undeclared property \Vtiger_Record_Model->executeUser
      Open

                              $fieldValue = $recordModel->executeUser;

      Reference to undeclared property \VTCreateEntityTask->field_value_mapping (Did you mean $fieldValueMapping)
      Open

                  $fieldValueMapping = \App\Json::decode($this->field_value_mapping);

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

                              $userId = App\User::getUserIdByName($fieldValue);

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

                      $userId = App\User::getUserIdByName($fieldValue);

      Reference to undeclared property \VTCreateEntityTask->relationId
      Open

                  $relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);

      Reference to undeclared property \VTCreateEntityTask->entity_type
      Open

              $entityType = $this->entity_type;

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  } elseif ('expression' == $fieldValueType) {
                      require_once 'modules/com_vtiger_workflow/expression_engine/include.php';
      
                      $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
                      $expression = $parser->expression();
      Severity: Minor
      Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php and 1 other location - About 45 mins to fix
      modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php on lines 54..65

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 96.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                      } elseif ('expression' === $fieldValueType) {
                          require_once 'modules/com_vtiger_workflow/expression_engine/include.php';
      
                          $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));
                          $expression = $parser->expression();
      Severity: Minor
      Found in modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php and 1 other location - About 45 mins to fix
      modules/com_vtiger_workflow/tasks/VTCreateEntityTask.php on lines 143..154

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 96.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class VTCreateEntityTask extends VTTask

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 11.
      Open

      <?php

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

              $fieldValueMapping = [];

      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

                          if ($sourceModuleName === $entityType) {

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

                  $mandatoryFields = $newRecordModel->getModule()->getMandatoryFieldModels();

      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

                          $fieldValue = $parentRecordModel->get($fieldName);

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

              }

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

              $entityType = $this->entity_type;

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

                      $fieldValueType = $fieldInfo['valuetype'];

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

                      if ('fieldname' === $fieldValueType) {

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

                              if (!$userId && !$groupId) {

      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

              $ownerFields = [];

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

                      $exprEvaluater = new VTFieldExpressionEvaluater($expression);

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

                  } elseif (preg_match('/([^:]+):boolean$/', $fieldValue, $match)) {

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

           * @param string $destinyModuleName

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

          public function doTask($recordModel)

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

                      $fieldValue = trim($fieldInfo['value']);

      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

                              $fieldValue = $exprEvaluater->evaluate($recordModel);

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

                          if ('true' == $fieldValue) {

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

                              $fieldValue = $recordModel->executeUser;

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

                  $newRecordModel->setHandlerExceptions(['disableHandlerClasses' => ['Vtiger_Workflow_Handler']]);

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

                  $newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);

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

                      $newRecordModel = $this->setFieldMapping($fieldValueMapping, $newRecordModel, $parentRecordModel);

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

                      if ('' === $newRecordModel->get($field->getName()) || null === $newRecordModel->get($field->getName())) {

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

                          $fieldValue = $exprEvaluater->evaluate($parentRecordModel);

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

                          $fieldValue = 1;

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

                  $moduleName = explode('::', $destinyModuleName)[1];

      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

                      $newRecordModel->set($fieldName, $fieldValue);

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

                  if ($relationModel) {

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

              foreach ($fieldValueMapping as $fieldInfo) {

      Line exceeds 120 characters; contains 168 characters
      Open

                          $fieldValue = $sourceModuleName === $entityType ? $fieldValue = $recordModel->get($fieldValue) : $fieldValue = $parentRecordModel->get($fieldValue);

      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

                      $destinyModuleName = $this->getDestinyModuleName($fieldInfo['modulename']);

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

                              $groupId = \App\Fields\Owner::getGroupId($fieldValue);

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

                      $relationModel->addRelation($recordModel->getId(), $newRecordModel->getId());

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

                  if ('fieldname' === $fieldValueType) {

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

                          $fieldValue = $sourceModuleName === $entityType ? $fieldValue = $recordModel->get($fieldValue) : $fieldValue = $parentRecordModel->get($fieldValue);

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

                      require_once 'modules/com_vtiger_workflow/expression_engine/include.php';

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

                          $fieldValue = $exprEvaluater->evaluate($recordModel);

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

                      $fieldValue = $match[1];

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

                      $groupId = \App\Fields\Owner::getGroupId($fieldValue);

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

           * @return string|null

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

              if (strpos($destinyModuleName, 'destinyModule') > 0) {

      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 = $recordModel->getModuleName();

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

                      $sourceModuleName = $destinyModuleName ?? $fieldInfo['modulename'];

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

                          $expression = $parser->expression();

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

                          $fieldValue = $newRecordModel->getField($fieldName)->getUITypeModel()->getDBValue($fieldValue);

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

                      }

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

                      return true;

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

                      $newRecordModel->save();

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

          public function setFieldMapping($fieldValueMapping, $recordModel, $parentRecordModel)

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

                      $userId = App\User::getUserIdByName($fieldValue);

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

          {

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

                  $newRecordModel = Vtiger_Record_Model::getCleanInstance($entityType);

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

                  foreach ($fieldValueMapping as $fieldInfo) {

      Line exceeds 120 characters; contains 155 characters
      Open

                              $fieldValue = $sourceModuleName === $entityType ? $newRecordModel->get($fieldValue) : $fieldValue = $recordModel->get($fieldValue);

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

                      } elseif (preg_match('/([^:]+):boolean$/', $fieldValue, $match)) {

      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

                  } elseif ('expression' == $fieldValueType) {

      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

                  $ownerFields = array_keys($newRecordModel->getModule()->getFieldsByType('owner'));

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

                              $fieldValue = '0';

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

                          }

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

                  $newRecordModel->setRecordFieldValues($parentRecordModel);

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

                  if ($saveContinue) {

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

              $entityType = $this->entity_type;

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

              foreach ($recordModel->getModule()->getFields() as $name => $fieldModel) {

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

                      if ($this->relationId) {

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

                      $fieldValue = $recordModel->getField($fieldName)->getUITypeModel()->getDBValue($fieldValue);

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

           */

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

          private function getDestinyModuleName(string $destinyModuleName): ?string

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

              $recordId = $recordModel->getId();

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

                  return;

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

              if (!empty($this->field_value_mapping)) {

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

                          if ($this->relationId) {

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

                          if ('triggerUser' === $fieldValue) {

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

                          } elseif (!is_numeric($fieldValue)) {

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

                  $relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);

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

                  }

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

                  $parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);

      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

                      $ownerFields[] = $name;

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

                  $fieldName = $fieldInfo['fieldname'];

      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

                      if (!$userId && !$groupId) {

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

                          $fieldValue = (!$userId) ? $groupId : $userId;

      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

                              $fieldValue = '1';

      Line exceeds 120 characters; contains 141 characters
      Open

                  $relationModel = \Vtiger_Relation_Model::getInstance($recordModel->getModule(), $newRecordModel->getModule(), $this->relationId);

      Line exceeds 120 characters; contains 207 characters
      Open

                  if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {

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

                          $saveContinue = false;

      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

              return $moduleName;

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

          public $executeImmediately = true;

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

          public function getFieldNames()

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

          }

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

                  $fieldValueMapping = \App\Json::decode($this->field_value_mapping);

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

                              $fieldValue = $sourceModuleName === $entityType ? $newRecordModel->get($fieldValue) : $fieldValue = $recordModel->get($fieldValue);

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

                      } elseif ('expression' === $fieldValueType) {

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

                          $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

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

                          $fieldValue = $match[1];

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

                  // To handle cyclic process

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

              } elseif ($this->mappingPanel && $entityType) {

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

                  if (!empty($this->verifyIfExists) && ($relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $entityType, false)) && (int) $relationListView->getRelatedEntriesCount() > 0) {

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

                  if (!empty($fieldValueMapping) && \is_array($fieldValueMapping)) {

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

                  foreach ($mandatoryFields as $field) {

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

                          $fieldValue = $destinyModuleName ? $parentRecordModel->get($fieldValue) : $recordModel->get($fieldValue);

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

                      if ($sourceModuleName === $entityType) {

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

                      if ('true' == $fieldValue) {

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

                          $fieldValue = 0;

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

           * Get destiny module name.

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

              return ['entity_type', 'reference_field', 'field_value_mapping', 'mappingPanel', 'verifyIfExists', 'relationId'];

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

           * @param Vtiger_Record_Model $recordModel

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

              if (!\App\Module::isModuleActive($entityType)) {

      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 (!$this->mappingPanel && !empty($entityType) && !empty($fieldValueMapping) && \count($fieldValueMapping) > 0) {

      Line exceeds 120 characters; contains 122 characters
      Open

              if (!$this->mappingPanel && !empty($entityType) && !empty($fieldValueMapping) && \count($fieldValueMapping) > 0) {

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

                      $fieldName = $fieldInfo['fieldname'];

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

                              $fieldValue = $destinyModuleName ? $newRecordModel->get($fieldValue) : $recordModel->get($fieldValue);

      Line exceeds 120 characters; contains 126 characters
      Open

                              $fieldValue = $destinyModuleName ? $newRecordModel->get($fieldValue) : $recordModel->get($fieldValue);

      Line exceeds 120 characters; contains 122 characters
      Open

                          $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

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

                              $fieldValue = $exprEvaluater->evaluate($newRecordModel);

      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

                  $newRecordModel->set($this->reference_field, $recordId);

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

                  $newRecordModel->save();

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

                  $saveContinue = true;

      Line exceeds 120 characters; contains 121 characters
      Open

                      if ('' === $newRecordModel->get($field->getName()) || null === $newRecordModel->get($field->getName())) {

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

          }

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

                  $sourceModuleName = $destinyModuleName ?? $fieldInfo['modulename'];

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

                  if (\in_array($fieldName, $ownerFields) && !is_numeric($fieldValue)) {

      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 = null;

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

          }

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

                              $userId = App\User::getUserIdByName($fieldValue);

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

                                  $fieldValue = $recordModel->get($fieldName);

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

                  }

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

              return $recordModel;

      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

                          require_once 'modules/com_vtiger_workflow/expression_engine/include.php';

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

                          $exprEvaluater = new VTFieldExpressionEvaluater($expression);

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

                          }

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

                      } elseif (!\in_array($fieldName, $ownerFields)) {

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

                      if (\in_array($fieldName, $ownerFields)) {

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

                          }

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

                  $fieldValue = trim($fieldInfo['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

                      $parser = new VTExpressionParser(new VTExpressionSpaceFilter(new VTExpressionTokenizer($fieldValue)));

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

                      $expression = $parser->expression();

      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

                      }

      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

                  if ('owner' === $fieldModel->getFieldDataType()) {

      Line exceeds 120 characters; contains 121 characters
      Open

              return ['entity_type', 'reference_field', 'field_value_mapping', 'mappingPanel', 'verifyIfExists', 'relationId'];

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

           * Execute task.

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

                                  $fieldValue = (!$userId) ? $groupId : $userId;

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

                  $fieldValueType = $fieldInfo['valuetype'];

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

                  $destinyModuleName = $this->getDestinyModuleName($fieldInfo['modulename']);

      Line exceeds 120 characters; contains 125 characters
      Open

                          $fieldValue = $destinyModuleName ? $parentRecordModel->get($fieldValue) : $recordModel->get($fieldValue);

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

                  } elseif (!\in_array($fieldName, $ownerFields)) {

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

                  }

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

                  $recordModel->set($fieldName, $fieldValue);

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

              }

      There are no issues that match your filters.

      Category
      Status