YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/handlers/Workflow.php

Summary

Maintainability
B
6 hrs
Test Coverage
D
63%

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])) {
Severity: Minor
Found in modules/Vtiger/handlers/Workflow.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 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])) {
Severity: Major
Found in modules/Vtiger/handlers/Workflow.php - About 2 hrs to fix

    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])) {
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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])) {
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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 = [])
    Severity: Critical
    Found in modules/Vtiger/handlers/Workflow.php by sonar-php

    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();
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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);
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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
                ]);
            }
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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;
                        }
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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;
                        }
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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)) {
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phan

    Reference to undeclared property \Workflow->executionCondition
    Open

                        throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phan

    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())) {
    Severity: Info
    Found in modules/Vtiger/handlers/Workflow.php by phan

    Reference to undeclared property \Workflow->executionCondition
    Open

                    if (VTWorkflowManager::$ONCE == $workflow->executionCondition) {
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phan

    Reference to undeclared property \Workflow->executionCondition
    Open

                switch ($workflow->executionCondition) {
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phan

    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;

    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;

    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;

    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;

    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;

    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

    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

    The class Vtiger_Workflow_Handler is not named in CamelCase.
    Open

    class Vtiger_Workflow_Handler
    {
        private $workflows;
    
        /**
    Severity: Minor
    Found in modules/Vtiger/handlers/Workflow.php by phpmd

    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, [

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param int[]             $condition

    Spaces must be used for alignment; tabs are not allowed
    Open

            $recordModel = $eventHandler->getRecordModel();

    Spaces must be used for alignment; tabs are not allowed
    Open

            } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         * EntityAfterSave function.

    Spaces must be used for alignment; tabs are not allowed
    Open

                VTWorkflowManager::$ONCE,

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

                VTWorkflowManager::$ON_FIRST_SAVE,

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * EntityChangeState handler function.

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->performTasks($eventHandler, [

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function entityAfterSave(App\EventHandler $eventHandler)

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->performTasks($eventHandler, [

    Spaces must be used for alignment; tabs are not allowed
    Open

            $this->performTasks($eventHandler, [

    Spaces must be used for alignment; tabs are not allowed
    Open

            $this->entityAfterSave($eventHandler);

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param App\EventHandler $eventHandler

    Spaces must be used for alignment; tabs are not allowed
    Open

                VTWorkflowManager::$ON_DELETE

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param App\EventHandler $eventHandler

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

        private $workflows;

    Spaces must be used for alignment; tabs are not allowed
    Open

            if ('Trash' === $eventHandler->getRecordModel()->get('deleted')) {

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function entityAfterDelete(App\EventHandler $eventHandler)

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

            ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function entityChangeState(App\EventHandler $eventHandler)

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

            ]);

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param App\EventHandler $eventHandler

    Spaces must be used for alignment; tabs are not allowed
    Open

            $moduleName = $eventHandler->getModuleName();

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

                    VTWorkflowManager::$ON_DELETE

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

                VTWorkflowManager::$ON_MODIFY

    Spaces must be used for alignment; tabs are not allowed
    Open

        private function performTasks(App\EventHandler $eventHandler, $condition = [])

    Spaces must be used for alignment; tabs are not allowed
    Open

     * @package        Handler

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

                    VTWorkflowManager::$ON_EVERY_SAVE

    Spaces must be used for alignment; tabs are not allowed
    Open

         * EntityAfterDelete handler function.

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * Perform workflow tasks.

    Spaces must be used for alignment; tabs are not allowed
    Open

                VTWorkflowManager::$ON_EVERY_SAVE,

    Spaces must be used for alignment; tabs are not allowed
    Open

         * UserAfterSave function.

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function userAfterSave(App\EventHandler $eventHandler)

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param \App\EventHandler $eventHandler

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $workflow->markAsCompletedForRecord($recordModel->getId());

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param App\EventHandler $eventHandler

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

                        if ($workflow->isCompletedForRecord($recordModel->getId())) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                switch ($workflow->executionCondition) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                        }

    Spaces must be used for alignment; tabs are not allowed
    Open

                        }

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ON_DELETE:

    Spaces must be used for alignment; tabs are not allowed
    Open

                    }

    Spaces must be used for alignment; tabs are not allowed
    Open

                $wfs = new VTWorkflowManager();

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $doEvaluate = true;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                    $workflow->performTasks($recordModel);

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $doEvaluate = true;

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ON_EVERY_SAVE:

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$MANUAL:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @throws \Exception

    Spaces must be used for alignment; tabs are not allowed
    Open

                    continue;

    Spaces must be used for alignment; tabs are not allowed
    Open

            if (!isset($this->workflows[$moduleName])) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                $this->workflows[$moduleName] = $wfs->getWorkflowsForModule($moduleName);

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ONCE:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$TRIGGER:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                }

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

                }

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

                }

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ON_FIRST_SAVE:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);

    Spaces must be used for alignment; tabs are not allowed
    Open

            foreach ($this->workflows[$moduleName] as &$workflow) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ON_SCHEDULE:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = true;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                    if (VTWorkflowManager::$ONCE == $workflow->executionCondition) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $doEvaluate = false;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = true;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$BLOCK_EDIT:

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ON_RELATED:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

                        if ($recordModel->isNew()) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                    default:

    Spaces must be used for alignment; tabs are not allowed
    Open

                if ($condition && !\in_array($workflow->executionCondition, $condition)) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                    case VTWorkflowManager::$ON_MODIFY:

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $doEvaluate = !$recordModel->isNew() && !empty($recordModel->getPreviousValue());

    Spaces must be used for alignment; tabs are not allowed
    Open

                if ($doEvaluate && $workflow->evaluate($recordModel, $recordModel->getId())) {

    Line exceeds 120 characters; contains 139 characters
    Open

                        throw new \App\Exceptions\AppException('Should never come here! Execution Condition:' . $workflow->executionCondition);

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

    class Vtiger_Workflow_Handler

    There are no issues that match your filters.

    Category
    Status