YetiForceCompany/YetiForceCRM

View on GitHub
modules/com_vtiger_workflow/VTWorkflowManager.php

Summary

Maintainability
A
3 hrs
Test Coverage
F
33%

Method save has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save(Workflow $workflow)
    {
        if (isset($workflow->id)) {
            $wf = $workflow;
            if (null === $wf->filtersavedinnew) {
Severity: Minor
Found in modules/com_vtiger_workflow/VTWorkflowManager.php - About 1 hr to fix

    Function getWorkflowsForModule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getWorkflowsForModule($moduleName, $executionCondition = false)
        {
            if (\App\Cache::has('WorkflowsForModule', $moduleName)) {
                $rows = \App\Cache::get('WorkflowsForModule', $moduleName);
            } else {
    Severity: Minor
    Found in modules/com_vtiger_workflow/VTWorkflowManager.php - About 45 mins 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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save(Workflow $workflow)
        {
            if (isset($workflow->id)) {
                $wf = $workflow;
                if (null === $wf->filtersavedinnew) {
    Severity: Minor
    Found in modules/com_vtiger_workflow/VTWorkflowManager.php - About 25 mins 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

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

        public function save(Workflow $workflow)
        {
            if (isset($workflow->id)) {
                $wf = $workflow;
                if (null === $wf->filtersavedinnew) {

    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 18 to the 15 allowed.
    Open

        public function save(Workflow $workflow)

    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 '185', column '17').
    Open

                $rows = (new \App\Db\Query())

    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 getScheduledWorkflows has a boolean flag argument $referenceTime, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getScheduledWorkflows($referenceTime = false)

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Missing class import via use statement (line '149', column '17').
    Open

            $query = (new \App\Db\Query())

    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 '268', column '20').
    Open

            $subQuery = (new \App\Db\Query())->select(['workflow_id'])->from('com_vtiger_workflows')->where(['workflow_id' => $id])->andWhere(['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]);

    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 getWorkflowsForModule has a boolean flag argument $executionCondition, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getWorkflowsForModule($moduleName, $executionCondition = false)

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Missing class import via use statement (line '235', column '14').
    Open

            return new Workflow();

    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 '250', column '16').
    Open

            $data = (new App\Db\Query())->from('com_vtiger_workflows')->where(['workflow_id' => $id])->one();

    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 '165', column '17').
    Open

            $query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);

    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\Cache' in method 'getWorkflowsForModule'.
    Open

            if (\App\Cache::has('WorkflowsForModule', $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

    Avoid using static access to class '\App\Cache' in method 'getWorkflowsForModule'.
    Open

                \App\Cache::save('WorkflowsForModule', $moduleName, $rows);

    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 getWorkflowsForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $rows = (new \App\Db\Query())
                    ->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew', 'params'])
                    ->from('com_vtiger_workflows')
                    ->where(['module_name' => $moduleName])

    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\Cache' in method 'getWorkflowsForModule'.
    Open

                $rows = \App\Cache::get('WorkflowsForModule', $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 save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $db = App\Db::getInstance();
                $wf = $workflow;
                if (null === $wf->filtersavedinnew) {
                    $wf->filtersavedinnew = 5;

    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\Db' in method 'save'.
    Open

                $db = App\Db::getInstance();

    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

    Remove the unused function parameter "$type".
    Open

        protected function getWorkflowInstance($type = 'basic')

    Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

    Noncompliant Code Example

    function doSomething($a, $b) { // "$a" is unused
      return compute($b);
    }
    

    Compliant Solution

    function doSomething($b) {
      return compute($b);
    }
    

    Exceptions

    Functions in classes that override a class or implement interfaces are ignored.

    class C extends B {
    
      function doSomething($a, $b) {     // no issue reported on $b
        compute($a);
      }
    
    }
    

    See

    • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
    • MISRA C:2012, 2.7 - There should be no unused parameters in functions
    • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
    • CERT, MSC12-CPP. - Detect and remove code that has no effect

    Define a constant instead of duplicating this literal "WorkflowsForModule" 3 times.
    Open

            if (\App\Cache::has('WorkflowsForModule', $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.

    Define a constant instead of duplicating this literal "module_name" 5 times.
    Open

                    'module_name' => $wf->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.

    Define a constant instead of duplicating this literal "com_vtiger_workflows" 8 times.
    Open

                App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', [

    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 "workflow_id" 8 times.
    Open

                ], ['workflow_id' => $wf->id])->execute();

    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 "summary" 4 times.
    Open

                    'summary' => $wf->description,

    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 "filtersavedinnew" 4 times.
    Open

                    'filtersavedinnew' => $wf->filtersavedinnew,

    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 "defaultworkflow" 8 times.
    Open

                    'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,

    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 "execution_condition" 6 times.
    Open

                    'execution_condition' => $wf->executionCondition,

    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 "nexttrigger_time" 4 times.
    Open

                    'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,

    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 "params" 3 times.
    Open

                    'params' => empty($wf->params) ? null : $wf->params,

    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.

    Avoid unused parameters such as '$type'.
    Open

        protected function getWorkflowInstance($type = 'basic')

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Reference to undeclared property \Workflow->id
    Open

            if (isset($workflow->id)) {

    Reference to undeclared property \Workflow->filtersavedinnew
    Open

                    $wf->filtersavedinnew = 5;

    Reference to undeclared property \Workflow->test
    Open

                    'test' => $wf->test,

    Reference to undeclared property \Workflow->executionCondition
    Open

                    'execution_condition' => $wf->executionCondition,

    Reference to undeclared property \Workflow->description
    Open

                    'summary' => $wf->description,

    Reference to undeclared property \Workflow->moduleName
    Open

                    'module_name' => $wf->moduleName,

    Reference to undeclared property \Workflow->schtime
    Open

                    'schtime' => $wf->schtime,

    Reference to undeclared property \Workflow->filtersavedinnew
    Open

                if (null === $wf->filtersavedinnew) {

    Reference to undeclared property \Workflow->filtersavedinnew
    Open

                    'filtersavedinnew' => $wf->filtersavedinnew,

    Reference to undeclared property \Workflow->schtypeid
    Open

                    'schtypeid' => $wf->schtypeid,

    Reference to undeclared property \Workflow->defaultworkflow
    Open

                    'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,

    Reference to undeclared property \Workflow->schdayofmonth
    Open

                    'schdayofmonth' => $wf->schdayofmonth,

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->insert('com_vtiger_workflows', [

    Reference to undeclared property \Workflow->filtersavedinnew
    Open

                    'filtersavedinnew' => $wf->filtersavedinnew,

    Call to undeclared method \App\Db\Query::select
    Open

            $subQuery = (new \App\Db\Query())->select(['workflow_id'])->from('com_vtiger_workflows')->where(['workflow_id' => $id])->andWhere(['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]);

    Reference to instance property executionCondition from undeclared class \workflowClass
    Open

            $workflow->executionCondition = self::$ON_EVERY_SAVE;

    Reference to instance property type from undeclared class \workflowClass
    Open

            $workflow->type = 'basic';

    Reference to undeclared property \Workflow->schtypeid
    Open

                    'schtypeid' => $wf->schtypeid,

    Reference to undeclared property \Workflow->params
    Open

                    'params' => empty($wf->params) ? null : $wf->params,

    Returning type null but retrieve() is declared to return \A
    Open

            return null;

    Returning type \workflowClass but newWorkflow() is declared to return \Workflow
    Open

            return $workflow;

    Reference to undeclared property \Workflow->description
    Open

                    'summary' => $wf->description,

    Call to undeclared method \App\Db::createCommand
    Open

                App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', [

    Reference to undeclared property \Workflow->filtersavedinnew
    Open

                    $wf->filtersavedinnew = 5;

    Reference to undeclared property \Workflow->test
    Open

                    'test' => $wf->test,

    Call to method setup from undeclared class \workflowClass
    Open

                $workflow->setup($row);

    Saw possibly unextractable annotation for a fragment of comment '* @param The id of the workflow': after The, did not see an element name (will guess based on comment order)
    Open

         * @param The id of the workflow

    Reference to undeclared property \Workflow->nexttrigger_time
    Open

                    'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,

    Reference to undeclared property \Workflow->defaultworkflow
    Open

                    'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,

    Reference to undeclared property \Workflow->schtime
    Open

                    'schtime' => $wf->schtime,

    Default value for object $referenceTime can't be false
    Open

        public function getScheduledWorkflows($referenceTime = false)

    Return type of retrieve() is undeclared type \A
    Open

        public function retrieve($id)

    Reference to undeclared property \Workflow->filtersavedinnew
    Open

                if (null === $wf->filtersavedinnew) {

    Reference to undeclared property \Workflow->type
    Open

                    'type' => $wf->type,

    Reference to undeclared property \Workflow->nexttrigger_time
    Open

                    'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,

    Default value for string $executionCondition can't be false
    Open

        public function getWorkflowsForModule($moduleName, $executionCondition = false)

    Returning type \workflowClass but retrieve() is declared to return \A
    Open

                return $workflow;

    Reference to undeclared property \Workflow->schdayofweek
    Open

                    'schdayofweek' => $wf->schdayofweek,

    Reference to undeclared property \Workflow->executionCondition
    Open

                    'execution_condition' => $wf->executionCondition,

    Returning type \Workflow[] but getScheduledWorkflows() is declared to return \Workflow
    Open

            return $this->getWorkflowsForResult($query->all());

    Reference to undeclared property \Workflow->schannualdates
    Open

                    'schannualdates' => $wf->schannualdates,

    Call to undeclared method \App\Db::createCommand
    Open

            $dbCommand = \App\Db::getInstance()->createCommand();

    Call to undeclared method \App\Db\Query::select
    Open

            $query = (new \App\Db\Query())

    Reference to undeclared property \Workflow->id
    Open

                ], ['workflow_id' => $wf->id])->execute();

    Reference to undeclared property \Workflow->id
    Open

                $wf->id = $db->getLastInsertID('com_vtiger_workflows_workflow_id_seq');

    Reference to undeclared property \Workflow->params
    Open

                    'params' => empty($wf->params) ? null : $wf->params,

    Reference to undeclared property \Workflow->schdayofmonth
    Open

                    'schdayofmonth' => $wf->schdayofmonth,

    Call to undeclared method \App\Db\Query::select
    Open

                $rows = (new \App\Db\Query())

    Returning type \Workflow but getWorkflowInstance() is declared to return \workflowClass
    Open

            return new Workflow();

    Reference to undeclared property \Workflow->moduleName
    Open

                    'module_name' => $wf->moduleName,

    Call to undeclared method \App\Db\Query::from
    Open

            $data = (new App\Db\Query())->from('com_vtiger_workflows')->where(['workflow_id' => $id])->one();

    Reference to undeclared property \Workflow->schdayofweek
    Open

                    'schdayofweek' => $wf->schdayofweek,

    Reference to undeclared property \Workflow->schannualdates
    Open

                    'schannualdates' => $wf->schannualdates,

    Reference to undeclared property \Workflow->sequence
    Open

                    'sequence' => (int) $wf->sequence,

    Return type of getWorkflowInstance() is undeclared type \workflowClass
    Open

        protected function getWorkflowInstance($type = 'basic')

    Call to method setup from undeclared class \workflowClass
    Open

                $workflow->setup($data);

    Reference to instance property moduleName from undeclared class \workflowClass
    Open

            $workflow->moduleName = $moduleName;

    Call to undeclared method \App\Db\Query::from
    Open

            $query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);

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

    class VTWorkflowManager

    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 15 and the first side effect is on line 11.
    Open

    <?php

    Avoid variables with short names like $wf. Configured minimum length is 3.
    Open

                $wf = $workflow;

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    The property $ON_EVERY_SAVE is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $ON_MODIFY is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $ON_RELATED is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

                $db = App\Db::getInstance();

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

        public function retrieve($id)

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    The property $ON_DELETE is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $BLOCK_EDIT is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $ON_FIRST_SAVE is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $ON_SCHEDULE is not named in camelCase.
    Open

    class VTWorkflowManager
    {
        /**
         * On first save.
         *

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

        public function delete($id)

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

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

        /**

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

         * @var int

    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

                    'schdayofmonth' => $wf->schdayofmonth,

    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 workflows.

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

         * Return workflows for module.

    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

        /**

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

                }

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

                    'schdayofweek' => $wf->schdayofweek,

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

                ], ['workflow_id' => $wf->id])->execute();

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

                    'params' => empty($wf->params) ? null : $wf->params,

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

         * @return Workflow[]

    Line exceeds 120 characters; contains 123 characters
    Open

            $query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);

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

                \App\Cache::save('WorkflowsForModule', $moduleName, $rows);

    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 workflows for provided rows.

    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 $workflows;

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

        public static $ONCE = 2;

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

         *

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

        public static $MANUAL = 7;

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

        public static $TRIGGER = 8;

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

         */

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

                $wf = $workflow;

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

                    'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,

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

                ])->execute();

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

        {

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

         * Function returns scheduled workflows.

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

         * @param string $executionCondition

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

                    ->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew', 'params'])

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

                foreach ($rows as $key => &$row) {

    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

         * Once.

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

        public static $BLOCK_EDIT = 9;

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

        {

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

                    $wf->filtersavedinnew = 5;

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

                    'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,

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

                    'sequence' => (int) $wf->sequence,

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

                ->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew'])

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

    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

            foreach ($rows as &$row) {

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

                if (!is_a($workflow, 'Workflow')) {

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

                $workflows[] = $workflow;

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

         *

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

         * @var int

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

        public static $ON_MODIFY = 4;

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

         */

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

         * @var int

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

        public static $ON_RELATED = 10;

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

         *

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

                    'schannualdates' => $wf->schannualdates,

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

                    'schannualdates' => $wf->schannualdates,

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

         *

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

                $query->andWhere(['or', ['nexttrigger_time' => null], ['<=', 'nexttrigger_time', $referenceTime]]);

    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

        /**

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

            }

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

         * Create new workflow in module.

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

            $workflow = $this->getWorkflowInstance();

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

         *

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

        public static $ON_EVERY_SAVE = 3;

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

         * @var int

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

         * @var int

    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 (isset($workflow->id)) {

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

                    'summary' => $wf->description,

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

                    'schdayofweek' => $wf->schdayofweek,

    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

        {

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

                    ->from('com_vtiger_workflows')

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

            $workflows = [];

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

         * @var int

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

         * On related.

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

         * @param Workflow $workflow

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

                    'execution_condition' => $wf->executionCondition,

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

                $db->createCommand()->insert('com_vtiger_workflows', [

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

                    'type' => $wf->type,

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

                    'schtypeid' => $wf->schtypeid,

    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 $this->getWorkflowsForResult($query->all());

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

                    ->all();

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

                    if ($row['execution_condition'] !== $executionCondition) {

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

        protected function getWorkflowsForResult($rows)

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

         * Retrieve a workflow from the database.

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

            $dbCommand->delete('com_vtiger_workflows', ['and', ['workflow_id' => $id], ['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]])->execute();

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

         * On every save.

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

         * @var int

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

         *

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

        public static $ON_SCHEDULE = 6;

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

        /**

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

                    'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,

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

                App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', [

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

            $query = (new \App\Db\Query())

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

                $db = App\Db::getInstance();

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

         * @return Workflow

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

                    'filtersavedinnew' => $wf->filtersavedinnew,

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

         * @param string $moduleName

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

        public function getWorkflows()

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

                $rows = (new \App\Db\Query())

    Line exceeds 120 characters; contains 141 characters
    Open

                ->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew'])

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

                    ->where(['module_name' => $moduleName])

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

            return $this->getWorkflowsForResult($rows);

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

         *

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

                    continue;

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

         * On first save.

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

         * @var int

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

         *

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

                    'schtypeid' => $wf->schtypeid,

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

         * Return workflow instance.

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

         * @param string $type

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

                $wf = $workflow;

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

                    'schtime' => $wf->schtime,

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

            return $this->getWorkflowsForResult($query->all());

    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/VTWorkflowManager.php';

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

         * @return A workflow object

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

                    ->orderBy(['sequence' => SORT_ASC])

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

            if ($data) {

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

                $workflow = $this->getWorkflowInstance($data['type']);

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

         * Delete workflow.

    Line exceeds 120 characters; contains 162 characters
    Open

            $dbCommand->delete('com_vtiger_workflows', ['and', ['workflow_id' => $id], ['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]])->execute();

    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

        public static $ON_DELETE = 5;

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

         * Manual.

    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

         */

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

         * Save workflow data.

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

        /**

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

                    'schtime' => $wf->schtime,

    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

            } else {

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

                    'test' => $wf->test,

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

                    'module_name' => $wf->moduleName,

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

                    'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,

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

        /**

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

        public function getScheduledWorkflows($referenceTime = false)

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

                    'test' => $wf->test,

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

                $rows = \App\Cache::get('WorkflowsForModule', $moduleName);

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

                if (null === $wf->filtersavedinnew) {

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

         * @param object $referenceTime DateTime

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

         * @param array $rows

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

        {

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

            $query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);

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

                    'execution_condition' => $wf->executionCondition,

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

        /**

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

                $workflow = $this->getWorkflowInstance($row['type']);

    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

                ->from('com_vtiger_workflows');

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

         * @return Workflow[]

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

            $subQuery = (new \App\Db\Query())->select(['workflow_id'])->from('com_vtiger_workflows')->where(['workflow_id' => $id])->andWhere(['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]);

    Line exceeds 120 characters; contains 155 characters
    Open

                    ->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew', 'params'])

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

            $dbCommand->delete('com_vtiger_workflowtasks', ['workflow_id' => $subQuery])->execute();

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

         * @return Workflow[]

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

            if (\App\Cache::has('WorkflowsForModule', $moduleName)) {

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

         * @param string $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

                        unset($rows[$key]);

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

            $workflow->type = 'basic';

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

         * @return \workflowClass

    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

        public function delete($id)

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

        {

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

        }

    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

         * @var int

    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

        public function save(Workflow $workflow)

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

                    'filtersavedinnew' => $wf->filtersavedinnew,

    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

         * Returns null if the workflow doesn't exist.

    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

        public static $ON_FIRST_SAVE = 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

         * On modify.

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

         * On delete.

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

         * Trigger.

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

         * On schedule.

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

         * @var int

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

         * Block edit.

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

         */

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

                    'params' => empty($wf->params) ? null : $wf->params,

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

                if (null === $wf->filtersavedinnew) {

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

                    $wf->filtersavedinnew = 5;

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

                    'summary' => $wf->description,

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

                    'module_name' => $wf->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

                    'schdayofmonth' => $wf->schdayofmonth,

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

        }

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

                $wf->id = $db->getLastInsertID('com_vtiger_workflows_workflow_id_seq');

    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

        public function getWorkflowsForModule($moduleName, $executionCondition = 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

            if ($executionCondition) {

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

            return $workflow;

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

         */

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

                $workflow->setup($row);

    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

         *

    Line exceeds 120 characters; contains 205 characters
    Open

            $subQuery = (new \App\Db\Query())->select(['workflow_id'])->from('com_vtiger_workflows')->where(['workflow_id' => $id])->andWhere(['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]);

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

         * @return Workflow

    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

         *

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

            return new Workflow();

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

         * @param mixed $id

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

            $data = (new App\Db\Query())->from('com_vtiger_workflows')->where(['workflow_id' => $id])->one();

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

            return 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

            $workflow->setNextTriggerTime($workflow->getNextTriggerTime());

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

        {

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

                $workflow->setup($data);

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

         * @param int $id

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

         */

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

            $workflow->executionCondition = self::$ON_EVERY_SAVE;

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

         * @param The id of the workflow

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

                return $workflow;

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

        /**

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

         * Update the Next trigger timestamp for a workflow.

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

         *

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

        public function retrieve($id)

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

         */

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

            $dbCommand = \App\Db::getInstance()->createCommand();

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

        public function updateNexTriggerTime(Workflow $workflow)

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

        protected function getWorkflowInstance($type = 'basic')

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

        {

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

         * @param Workflow $workflow

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

         */

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

        public function newWorkflow($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

            $workflow->moduleName = $moduleName;

    There are no issues that match your filters.

    Category
    Status