Function performTasks
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private function performTasks(App\EventHandler $eventHandler, $condition = [])
{
$recordModel = $eventHandler->getRecordModel();
$moduleName = $eventHandler->getModuleName();
if (!isset($this->workflows[$moduleName])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method performTasks
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function performTasks(App\EventHandler $eventHandler, $condition = [])
{
$recordModel = $eventHandler->getRecordModel();
$moduleName = $eventHandler->getModuleName();
if (!isset($this->workflows[$moduleName])) {
The method performTasks() has an NPath complexity of 314. The configured NPath complexity threshold is 200. Open
private function performTasks(App\EventHandler $eventHandler, $condition = [])
{
$recordModel = $eventHandler->getRecordModel();
$moduleName = $eventHandler->getModuleName();
if (!isset($this->workflows[$moduleName])) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method performTasks() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10. Open
private function performTasks(App\EventHandler $eventHandler, $condition = [])
{
$recordModel = $eventHandler->getRecordModel();
$moduleName = $eventHandler->getModuleName();
if (!isset($this->workflows[$moduleName])) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 22 to the 15 allowed. Open
private function performTasks(App\EventHandler $eventHandler, $condition = [])
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '86', column '15'). Open
$wfs = new VTWorkflowManager();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '133', column '16'). Open
throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method entityChangeState uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->performTasks($eventHandler, [
VTWorkflowManager::$ON_EVERY_SAVE
]);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method performTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$doEvaluate = true;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method performTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$doEvaluate = false;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Reference to undeclared property \Workflow->executionCondition
Open
if ($condition && !\in_array($workflow->executionCondition, $condition)) {
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);
- Exclude checks
Call with 2 arg(s) to \Workflow::evaluate()
which only takes 1 arg(s) defined at /code/modules/com_vtiger_workflow/Workflow.php:168
Open
if ($doEvaluate && $workflow->evaluate($recordModel, $recordModel->getId())) {
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
if (VTWorkflowManager::$ONCE == $workflow->executionCondition) {
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
switch ($workflow->executionCondition) {
- Exclude checks
This case's code block is the same as the block for the case on line 108. Open
case VTWorkflowManager::$ON_DELETE:
$doEvaluate = true;
break;
- Read upRead up
- Exclude checks
Having two cases
in a switch
statement or two branches in an if
chain with the same implementation is at
best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if
chain they should
be combined, or for a switch
, one should fall through to the other.
Noncompliant Code Example
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: // Noncompliant; duplicates case 1's implementation doSomething(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThing(); // Noncompliant; duplicates first condition } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doOneMoreThing(); // Noncompliant; duplicates then-branch } var b = a ? 12 > 4 : 4; // Noncompliant; always results in the same value
Compliant Solution
switch ($i) { case 1: case 3: doSomething(); break; case 2: doSomethingDifferent(); break; default: doTheRest(); } if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else { doTheRest(); } doOneMoreThing(); b = 4;
or
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: doThirdThing(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThirdThing(); } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doTheRest(); } int b = a ? 12 > 4 : 8;
Exceptions
Blocks in an if
chain that contain a single line of code are ignored, as are blocks in a switch
statement that contain a
single line of code with or without a following break
.
This case's code block is the same as the block for the case on line 114. Open
case VTWorkflowManager::$TRIGGER:
$doEvaluate = false;
break;
- Read upRead up
- Exclude checks
Having two cases
in a switch
statement or two branches in an if
chain with the same implementation is at
best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if
chain they should
be combined, or for a switch
, one should fall through to the other.
Noncompliant Code Example
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: // Noncompliant; duplicates case 1's implementation doSomething(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThing(); // Noncompliant; duplicates first condition } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doOneMoreThing(); // Noncompliant; duplicates then-branch } var b = a ? 12 > 4 : 4; // Noncompliant; always results in the same value
Compliant Solution
switch ($i) { case 1: case 3: doSomething(); break; case 2: doSomethingDifferent(); break; default: doTheRest(); } if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else { doTheRest(); } doOneMoreThing(); b = 4;
or
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: doThirdThing(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThirdThing(); } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doTheRest(); } int b = a ? 12 > 4 : 8;
Exceptions
Blocks in an if
chain that contain a single line of code are ignored, as are blocks in a switch
statement that contain a
single line of code with or without a following break
.
This case's code block is the same as the block for the case on line 114. Open
case VTWorkflowManager::$ON_SCHEDULE:
$doEvaluate = false;
break;
- Read upRead up
- Exclude checks
Having two cases
in a switch
statement or two branches in an if
chain with the same implementation is at
best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if
chain they should
be combined, or for a switch
, one should fall through to the other.
Noncompliant Code Example
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: // Noncompliant; duplicates case 1's implementation doSomething(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThing(); // Noncompliant; duplicates first condition } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doOneMoreThing(); // Noncompliant; duplicates then-branch } var b = a ? 12 > 4 : 4; // Noncompliant; always results in the same value
Compliant Solution
switch ($i) { case 1: case 3: doSomething(); break; case 2: doSomethingDifferent(); break; default: doTheRest(); } if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else { doTheRest(); } doOneMoreThing(); b = 4;
or
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: doThirdThing(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThirdThing(); } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doTheRest(); } int b = a ? 12 > 4 : 8;
Exceptions
Blocks in an if
chain that contain a single line of code are ignored, as are blocks in a switch
statement that contain a
single line of code with or without a following break
.
This case's code block is the same as the block for the case on line 114. Open
case VTWorkflowManager::$BLOCK_EDIT:
$doEvaluate = false;
break;
- Read upRead up
- Exclude checks
Having two cases
in a switch
statement or two branches in an if
chain with the same implementation is at
best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if
chain they should
be combined, or for a switch
, one should fall through to the other.
Noncompliant Code Example
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: // Noncompliant; duplicates case 1's implementation doSomething(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThing(); // Noncompliant; duplicates first condition } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doOneMoreThing(); // Noncompliant; duplicates then-branch } var b = a ? 12 > 4 : 4; // Noncompliant; always results in the same value
Compliant Solution
switch ($i) { case 1: case 3: doSomething(); break; case 2: doSomethingDifferent(); break; default: doTheRest(); } if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else { doTheRest(); } doOneMoreThing(); b = 4;
or
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: doThirdThing(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThirdThing(); } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doTheRest(); } int b = a ? 12 > 4 : 8;
Exceptions
Blocks in an if
chain that contain a single line of code are ignored, as are blocks in a switch
statement that contain a
single line of code with or without a following break
.
This case's code block is the same as the block for the case on line 114. Open
case VTWorkflowManager::$ON_RELATED:
$doEvaluate = false;
break;
- Read upRead up
- Exclude checks
Having two cases
in a switch
statement or two branches in an if
chain with the same implementation is at
best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if
chain they should
be combined, or for a switch
, one should fall through to the other.
Noncompliant Code Example
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: // Noncompliant; duplicates case 1's implementation doSomething(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThing(); // Noncompliant; duplicates first condition } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doOneMoreThing(); // Noncompliant; duplicates then-branch } var b = a ? 12 > 4 : 4; // Noncompliant; always results in the same value
Compliant Solution
switch ($i) { case 1: case 3: doSomething(); break; case 2: doSomethingDifferent(); break; default: doTheRest(); } if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else { doTheRest(); } doOneMoreThing(); b = 4;
or
switch ($i) { case 1: doSomething(); break; case 2: doSomethingDifferent(); break; case 3: doThirdThing(); break; default: doTheRest(); } if ($a >= 0 && $a < 10) { doTheThing(); else if ($a >= 10 && $a < 20) { doTheOtherThing(); } else if ($a >= 20 && $a < 50) { doTheThirdThing(); } else { doTheRest(); } if ($b == 0) { doOneMoreThing(); } else { doTheRest(); } int b = a ? 12 > 4 : 8;
Exceptions
Blocks in an if
chain that contain a single line of code are ignored, as are blocks in a switch
statement that contain a
single line of code with or without a following break
.
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_Workflow_Handler
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 14 and the first side effect is on line 3. Open
<?php
- Exclude checks
The class Vtiger_Workflow_Handler is not named in CamelCase. Open
class Vtiger_Workflow_Handler
{
private $workflows;
/**
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used for alignment; tabs are not allowed Open
$this->performTasks($eventHandler, [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param int[] $condition
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$recordModel = $eventHandler->getRecordModel();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* EntityAfterSave function.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ONCE,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ON_FIRST_SAVE,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* EntityChangeState handler function.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->performTasks($eventHandler, [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function entityAfterSave(App\EventHandler $eventHandler)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->performTasks($eventHandler, [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->performTasks($eventHandler, [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->entityAfterSave($eventHandler);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param App\EventHandler $eventHandler
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ON_DELETE
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param App\EventHandler $eventHandler
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
private $workflows;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ('Trash' === $eventHandler->getRecordModel()->get('deleted')) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function entityAfterDelete(App\EventHandler $eventHandler)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function entityChangeState(App\EventHandler $eventHandler)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param App\EventHandler $eventHandler
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$moduleName = $eventHandler->getModuleName();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ON_DELETE
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ON_MODIFY
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
private function performTasks(App\EventHandler $eventHandler, $condition = [])
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @package Handler
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ON_EVERY_SAVE
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* EntityAfterDelete handler function.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Perform workflow tasks.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
VTWorkflowManager::$ON_EVERY_SAVE,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* UserAfterSave function.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function userAfterSave(App\EventHandler $eventHandler)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param \App\EventHandler $eventHandler
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$workflow->markAsCompletedForRecord($recordModel->getId());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param App\EventHandler $eventHandler
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($workflow->isCompletedForRecord($recordModel->getId())) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
switch ($workflow->executionCondition) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ON_DELETE:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$wfs = new VTWorkflowManager();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$workflow->performTasks($recordModel);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ON_EVERY_SAVE:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$MANUAL:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @throws \Exception
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!isset($this->workflows[$moduleName])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$this->workflows[$moduleName] = $wfs->getWorkflowsForModule($moduleName);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ONCE:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$TRIGGER:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ON_FIRST_SAVE:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($this->workflows[$moduleName] as &$workflow) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ON_SCHEDULE:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (VTWorkflowManager::$ONCE == $workflow->executionCondition) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = false;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$BLOCK_EDIT:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ON_RELATED:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($recordModel->isNew()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($condition && !\in_array($workflow->executionCondition, $condition)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
case VTWorkflowManager::$ON_MODIFY:
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$doEvaluate = !$recordModel->isNew() && !empty($recordModel->getPreviousValue());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($doEvaluate && $workflow->evaluate($recordModel, $recordModel->getId())) {
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);
- Exclude checks
Class name "Vtiger_Workflow_Handler" is not in camel caps format Open
class Vtiger_Workflow_Handler
- Exclude checks