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) {
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 {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
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) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. Open
public function save(Workflow $workflow)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '185', column '17'). Open
$rows = (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getScheduledWorkflows has a boolean flag argument $referenceTime, which is a certain sign of a Single Responsibility Principle violation. Open
public function getScheduledWorkflows($referenceTime = false)
- Read upRead up
- Exclude checks
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())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '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]]);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method 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)
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '250', column '16'). Open
$data = (new App\Db\Query())->from('com_vtiger_workflows')->where(['workflow_id' => $id])->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '165', column '17'). Open
$query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Cache' in method 'getWorkflowsForModule'. Open
if (\App\Cache::has('WorkflowsForModule', $moduleName)) {
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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])
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Cache' in method 'getWorkflowsForModule'. Open
$rows = \App\Cache::get('WorkflowsForModule', $moduleName);
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Db' in method 'save'. Open
$db = App\Db::getInstance();
- Read upRead up
- Exclude checks
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')
- Read upRead up
- Exclude checks
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)) {
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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', [
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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,
- Read upRead up
- Exclude checks
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')
- Read upRead up
- Exclude checks
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)) {
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
$wf->filtersavedinnew = 5;
- Exclude checks
Reference to undeclared property \Workflow->test
Open
'test' => $wf->test,
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
'execution_condition' => $wf->executionCondition,
- Exclude checks
Reference to undeclared property \Workflow->description
Open
'summary' => $wf->description,
- Exclude checks
Reference to undeclared property \Workflow->moduleName
Open
'module_name' => $wf->moduleName,
- Exclude checks
Reference to undeclared property \Workflow->schtime
Open
'schtime' => $wf->schtime,
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
if (null === $wf->filtersavedinnew) {
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
'filtersavedinnew' => $wf->filtersavedinnew,
- Exclude checks
Reference to undeclared property \Workflow->schtypeid
Open
'schtypeid' => $wf->schtypeid,
- Exclude checks
Reference to undeclared property \Workflow->defaultworkflow
Open
'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,
- Exclude checks
Reference to undeclared property \Workflow->schdayofmonth
Open
'schdayofmonth' => $wf->schdayofmonth,
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('com_vtiger_workflows', [
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
'filtersavedinnew' => $wf->filtersavedinnew,
- Exclude checks
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]]);
- Exclude checks
Reference to instance property executionCondition
from undeclared class \workflowClass
Open
$workflow->executionCondition = self::$ON_EVERY_SAVE;
- Exclude checks
Reference to instance property type
from undeclared class \workflowClass
Open
$workflow->type = 'basic';
- Exclude checks
Reference to undeclared property \Workflow->schtypeid
Open
'schtypeid' => $wf->schtypeid,
- Exclude checks
Reference to undeclared property \Workflow->params
Open
'params' => empty($wf->params) ? null : $wf->params,
- Exclude checks
Returning type null
but retrieve()
is declared to return \A
Open
return null;
- Exclude checks
Returning type \workflowClass
but newWorkflow()
is declared to return \Workflow
Open
return $workflow;
- Exclude checks
Reference to undeclared property \Workflow->description
Open
'summary' => $wf->description,
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', [
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
$wf->filtersavedinnew = 5;
- Exclude checks
Reference to undeclared property \Workflow->test
Open
'test' => $wf->test,
- Exclude checks
Call to method setup
from undeclared class \workflowClass
Open
$workflow->setup($row);
- Exclude checks
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
- Exclude checks
Reference to undeclared property \Workflow->nexttrigger_time
Open
'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,
- Exclude checks
Reference to undeclared property \Workflow->defaultworkflow
Open
'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,
- Exclude checks
Reference to undeclared property \Workflow->schtime
Open
'schtime' => $wf->schtime,
- Exclude checks
Default value for object
$referenceTime
can't be false
Open
public function getScheduledWorkflows($referenceTime = false)
- Exclude checks
Return type of retrieve()
is undeclared type \A
Open
public function retrieve($id)
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
if (null === $wf->filtersavedinnew) {
- Exclude checks
Reference to undeclared property \Workflow->type
Open
'type' => $wf->type,
- Exclude checks
Reference to undeclared property \Workflow->nexttrigger_time
Open
'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,
- Exclude checks
Default value for string
$executionCondition
can't be false
Open
public function getWorkflowsForModule($moduleName, $executionCondition = false)
- Exclude checks
Returning type \workflowClass
but retrieve()
is declared to return \A
Open
return $workflow;
- Exclude checks
Reference to undeclared property \Workflow->schdayofweek
Open
'schdayofweek' => $wf->schdayofweek,
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
'execution_condition' => $wf->executionCondition,
- Exclude checks
Returning type \Workflow[]
but getScheduledWorkflows()
is declared to return \Workflow
Open
return $this->getWorkflowsForResult($query->all());
- Exclude checks
Reference to undeclared property \Workflow->schannualdates
Open
'schannualdates' => $wf->schannualdates,
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())
- Exclude checks
Reference to undeclared property \Workflow->id
Open
], ['workflow_id' => $wf->id])->execute();
- Exclude checks
Reference to undeclared property \Workflow->id
Open
$wf->id = $db->getLastInsertID('com_vtiger_workflows_workflow_id_seq');
- Exclude checks
Reference to undeclared property \Workflow->params
Open
'params' => empty($wf->params) ? null : $wf->params,
- Exclude checks
Reference to undeclared property \Workflow->schdayofmonth
Open
'schdayofmonth' => $wf->schdayofmonth,
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$rows = (new \App\Db\Query())
- Exclude checks
Returning type \Workflow
but getWorkflowInstance()
is declared to return \workflowClass
Open
return new Workflow();
- Exclude checks
Reference to undeclared property \Workflow->moduleName
Open
'module_name' => $wf->moduleName,
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$data = (new App\Db\Query())->from('com_vtiger_workflows')->where(['workflow_id' => $id])->one();
- Exclude checks
Reference to undeclared property \Workflow->schdayofweek
Open
'schdayofweek' => $wf->schdayofweek,
- Exclude checks
Reference to undeclared property \Workflow->schannualdates
Open
'schannualdates' => $wf->schannualdates,
- Exclude checks
Reference to undeclared property \Workflow->sequence
Open
'sequence' => (int) $wf->sequence,
- Exclude checks
Return type of getWorkflowInstance()
is undeclared type \workflowClass
Open
protected function getWorkflowInstance($type = 'basic')
- Exclude checks
Call to method setup
from undeclared class \workflowClass
Open
$workflow->setup($data);
- Exclude checks
Reference to instance property moduleName
from undeclared class \workflowClass
Open
$workflow->moduleName = $moduleName;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class VTWorkflowManager
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 15 and the first side effect is on line 11. Open
<?php
- Exclude checks
Avoid variables with short names like $wf. Configured minimum length is 3. Open
$wf = $workflow;
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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.
*
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schdayofmonth' => $wf->schdayofmonth,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return workflows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return workflows for module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schdayofweek' => $wf->schdayofweek,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['workflow_id' => $wf->id])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'params' => empty($wf->params) ? null : $wf->params,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Workflow[]
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$query = (new \App\Db\Query())->from('com_vtiger_workflows')->where(['execution_condition' => self::$ON_SCHEDULE]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('WorkflowsForModule', $moduleName, $rows);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return workflows for provided rows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $workflows;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ONCE = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $MANUAL = 7;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $TRIGGER = 8;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wf = $workflow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns scheduled workflows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $executionCondition
- Exclude checks
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'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($rows as $key => &$row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Once.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $BLOCK_EDIT = 9;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wf->filtersavedinnew = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sequence' => (int) $wf->sequence,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($referenceTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($rows as &$row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_a($workflow, 'Workflow')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflows[] = $workflow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ON_MODIFY = 4;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ON_RELATED = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schannualdates' => $wf->schannualdates,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schannualdates' => $wf->schannualdates,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['or', ['nexttrigger_time' => null], ['<=', 'nexttrigger_time', $referenceTime]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create new workflow in module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow = $this->getWorkflowInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ON_EVERY_SAVE = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($workflow->id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'summary' => $wf->description,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schdayofweek' => $wf->schdayofweek,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('com_vtiger_workflows')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflows = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* On related.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Workflow $workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'execution_condition' => $wf->executionCondition,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('com_vtiger_workflows', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => $wf->type,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schtypeid' => $wf->schtypeid,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getWorkflowsForResult($query->all());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row['execution_condition'] !== $executionCondition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function getWorkflowsForResult($rows)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Retrieve a workflow from the database.
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* On every save.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ON_SCHEDULE = 6;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'defaultworkflow' => empty($wf->defaultworkflow) ? null : $wf->defaultworkflow,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filtersavedinnew' => $wf->filtersavedinnew,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWorkflows()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = (new \App\Db\Query())
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['module_name' => $moduleName])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getWorkflowsForResult($rows);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* On first save.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schtypeid' => $wf->schtypeid,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return workflow instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wf = $workflow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schtime' => $wf->schtime,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getWorkflowsForResult($query->all());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/VTWorkflowManager.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return A workflow object
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->orderBy(['sequence' => SORT_ASC])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow = $this->getWorkflowInstance($data['type']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete workflow.
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
$dbCommand->delete('com_vtiger_workflows', ['and', ['workflow_id' => $id], ['or', ['defaultworkflow' => null], ['<>', 'defaultworkflow', 1]]])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ON_DELETE = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Manual.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Save workflow data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schtime' => $wf->schtime,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test' => $wf->test,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module_name' => $wf->moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nexttrigger_time' => empty($wf->nexttrigger_time) ? null : $wf->nexttrigger_time,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getScheduledWorkflows($referenceTime = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test' => $wf->test,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = \App\Cache::get('WorkflowsForModule', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $wf->filtersavedinnew) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param object $referenceTime DateTime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $rows
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
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]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'execution_condition' => $wf->executionCondition,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow = $this->getWorkflowInstance($row['type']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('com_vtiger_workflows');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Workflow[]
- Exclude checks
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]]);
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
->select(['workflow_id', 'module_name', 'summary', 'test', 'execution_condition', 'defaultworkflow', 'type', 'filtersavedinnew', 'params'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('com_vtiger_workflowtasks', ['workflow_id' => $subQuery])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Workflow[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has('WorkflowsForModule', $moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($rows[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow->type = 'basic';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \workflowClass
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function delete($id)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function save(Workflow $workflow)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filtersavedinnew' => $wf->filtersavedinnew,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Returns null if the workflow doesn't exist.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ON_FIRST_SAVE = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* On modify.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* On delete.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Trigger.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* On schedule.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Block edit.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'params' => empty($wf->params) ? null : $wf->params,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $wf->filtersavedinnew) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wf->filtersavedinnew = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'summary' => $wf->description,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module_name' => $wf->moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'schdayofmonth' => $wf->schdayofmonth,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$wf->id = $db->getLastInsertID('com_vtiger_workflows_workflow_id_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWorkflowsForModule($moduleName, $executionCondition = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($executionCondition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $workflow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow->setup($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
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]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return new Workflow();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $id
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow->setNextTriggerTime($workflow->getNextTriggerTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow->setup($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow->executionCondition = self::$ON_EVERY_SAVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param The id of the workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $workflow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update the Next trigger timestamp for a workflow.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function retrieve($id)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateNexTriggerTime(Workflow $workflow)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function getWorkflowInstance($type = 'basic')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Workflow $workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function newWorkflow($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflow->moduleName = $moduleName;
- Exclude checks