Function queueScheduledWorkflowTasks
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function queueScheduledWorkflowTasks()
{
$default_timezone = App\Config::main('default_timezone');
$vtWorflowManager = new VTWorkflowManager();
$taskQueue = new VTTaskQueue();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method addWorkflowConditionsToQueryGenerator
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addWorkflowConditionsToQueryGenerator(App\QueryGenerator $queryGenerator, $conditions)
{
$conditionMapping = [
'equal to' => 'e',
'less than' => 'l',
Function addWorkflowConditionsToQueryGenerator
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function addWorkflowConditionsToQueryGenerator(App\QueryGenerator $queryGenerator, $conditions)
{
$conditionMapping = [
'equal to' => 'e',
'less than' => 'l',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parseValueForDate
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseValueForDate($condition)
{
$value = $condition['value'];
$operation = $condition['operation'];
Function parseValueForDate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function parseValueForDate($condition)
{
$value = $condition['value'];
$operation = $condition['operation'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method queueScheduledWorkflowTasks
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queueScheduledWorkflowTasks()
{
$default_timezone = App\Config::main('default_timezone');
$vtWorflowManager = new VTWorkflowManager();
$taskQueue = new VTTaskQueue();
The method queueScheduledWorkflowTasks() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function queueScheduledWorkflowTasks()
{
$default_timezone = App\Config::main('default_timezone');
$vtWorflowManager = new VTWorkflowManager();
$taskQueue = new VTTaskQueue();
- 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
The method parseValueForDate() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function parseValueForDate($condition)
{
$value = $condition['value'];
$operation = $condition['operation'];
- 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 39 to the 15 allowed. Open
public function queueScheduledWorkflowTasks()
- 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
Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed. Open
public function addWorkflowConditionsToQueryGenerator(App\QueryGenerator $queryGenerator, $conditions)
- 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 '74', column '20'). Open
$taskQueue = new VTTaskQueue();
- 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 '48', column '25'). Open
$queryGenerator = new \App\QueryGenerator($moduleName, $this->user->id);
- 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 '73', column '27'). Open
$vtWorflowManager = new VTWorkflowManager();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'Users' in method 'queueScheduledWorkflowTasks'. Open
$admin = Users::getActiveAdminUser();
- 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\Purifier' in method 'getWorkflowQuery'. Open
$conditions = \App\Json::decode(App\Purifier::decodeHtml($workflow->test));
- 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 'Users' in method '__construct'. Open
$this->user = Users::getActiveAdminUser();
- 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 'Settings_Workflows_Record_Model' in method 'queueScheduledWorkflowTasks'. Open
$workflowRecord = Settings_Workflows_Record_Model::getInstanceFromWorkflowObject($workflow);
- 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 queueScheduledWorkflowTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$trigger = $taskRecord->getTaskObject()->trigger;
$delay = null !== $trigger ? strtotime($data[$trigger['field']]) + $trigger['days'] * 86400 : 0;
$taskQueue->queueTask($taskRecord->getId(), $recordModel->getId(), $delay);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method queueScheduledWorkflowTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
foreach ($this->getEligibleWorkflowRecords($workflow) as $recordId) {
if (!\App\Record::isExists($recordId)) {
continue;
}
- 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 'Vtiger_Record_Model' in method 'queueScheduledWorkflowTasks'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
- 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\Config' in method 'queueScheduledWorkflowTasks'. Open
$default_timezone = App\Config::main('default_timezone');
- 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\Record' in method 'queueScheduledWorkflowTasks'. Open
if (!\App\Record::isExists($recordId)) {
- 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\Json' in method 'getWorkflowQuery'. Open
$conditions = \App\Json::decode(App\Purifier::decodeHtml($workflow->test));
- 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 'Users' in method 'parseValueForDate'. Open
$admin = Users::getActiveAdminUser();
- 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 addWorkflowConditionsToQueryGenerator uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$queryGenerator->addCondition($fieldName, $value, $operator, empty($groupId));
}
- 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\Config' in method 'parseValueForDate'. Open
$default_timezone = \App\Config::main('default_timezone');
- 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
Define a constant instead of duplicating this literal "less than hours later" 3 times. Open
'less than hours later' => 'bw',
- 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 "in more than" 3 times. Open
'in more than' => 'g',
- 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 "value" 13 times. Open
$value = $condition['value'];
- 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 "more than hours later" 3 times. Open
'more than hours later' => 'g',
- 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 "days ago" 3 times. Open
'days ago' => 'e',
- 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 "Y-m-d H:i:s" 7 times. Open
$currentTimestamp = date('Y-m-d H:i:s');
- 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 "more than days ago" 3 times. Open
'more than days ago' => 'l',
- 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 "Y-m-d" 9 times. Open
$value = date('Y-m-d', strtotime('-' . $days . ' days')) . ',' . date('Y-m-d', strtotime('+1 day'));
- 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 "in less than" 3 times. Open
'in less than' => 'bw',
- 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 " hours" 4 times. Open
$value = date('Y-m-d H:i:s', strtotime('-' . $hours . ' hours')) . ',' . date('Y-m-d H:i:s');
- 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 "more than hours before" 3 times. Open
'more than hours before' => 'l',
- 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 "is today" 3 times. Open
'is today' => 'e',
- 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 "less than days ago" 3 times. Open
'less than days ago' => 'bw',
- 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 "less than hours before" 3 times. Open
'less than hours before' => 'bw',
- 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 "days later" 3 times. Open
'days later' => 'e',
- 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 " days" 6 times. Open
$value = date('Y-m-d', strtotime('-' . $days . ' days')) . ',' . date('Y-m-d', strtotime('+1 day'));
- 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.
Reference to undeclared property \Users->time_zone
Open
$adminTimeZone = $admin->time_zone;
- Exclude checks
Reference to undeclared property \Users->time_zone
Open
$adminTimeZone = $admin->time_zone;
- Exclude checks
Argument 1 (referenceTime)
is string
but \VTWorkflowManager::getScheduledWorkflows()
takes false|object
defined at /code/modules/com_vtiger_workflow/VTWorkflowManager.php:163
Open
$scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
- Exclude checks
Parameter $queryGenerator
has undeclared type \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
public function addWorkflowConditionsToQueryGenerator(App\QueryGenerator $queryGenerator, $conditions)
- Exclude checks
Reference to undeclared property \Workflow->test
Open
$conditions = \App\Json::decode(App\Purifier::decodeHtml($workflow->test));
- Exclude checks
Class \Workflow
was passed to foreach, but it does not extend Traversable. This may be intentional, because some of that class's declared properties are accessible from this context. (This check excludes dynamic properties) Open
foreach ($scheduledWorkflows as &$workflow) {
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition([$queryGenerator->getColumnName('id') => 0]);
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new \App\QueryGenerator($moduleName, $this->user->id);
- Exclude checks
Call to method getColumnName
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition([$queryGenerator->getColumnName('id') => 0]);
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
return $queryGenerator->createQuery();
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(['id']);
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition($fieldName, $value, $operator, empty($groupId));
- Exclude checks
Reference to undeclared property \Workflow->moduleName
Open
$moduleName = $workflow->moduleName;
- Exclude checks
Call to undeclared method \App\Db\Query::column
Open
return $query->column();
- Exclude checks
Call to method addRelatedCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addRelatedCondition([
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class WorkFlowScheduler
- 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 19 and the first side effect is on line 12. Open
<?php
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var Users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWorkflowQuery(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
* Get workflow query.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Constructor.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $queryGenerator->createQuery();
- 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
$this->user = Users::getActiveAdminUser();
- 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
$queryGenerator = new \App\QueryGenerator($moduleName, $this->user->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields(['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $workflow->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
private $user;
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($taskRecords) {
- 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
'does not equal' => 'n',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'om' => 'om',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'after' => 'g',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'greaterthannow' => 'greaterthannow',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions as &$condition) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('has changed' === $operation || 'not has changed' === $operation || !isset($conditionMapping[$operation])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $this->parseValueForDate($condition);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- 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
'between' => 'bw',
- 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
if (0 != \count($matches)) {
- 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
'less than hours before', 'less than hours later', 'more than hours later', 'more than hours before', 'is today', ];
- 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
// set the time zone to the admin's time zone, this is needed so that the scheduled workflow will be triggered
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$admin = Users::getActiveAdminUser();
- 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
foreach ($taskRecords as $taskRecord) {
- 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
* Add workflow conditions to query generator.
- 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
$value = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupId = $condition['groupid'] ?? 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is not empty' => 'ny',
- 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 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 function queueScheduledWorkflowTasks()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($workflowRecord->getParams('iterationOff')) {
- 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
'ends with' => 'ew',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is not' => 'n',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'less than days ago' => 'bw',
- 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
public function specialDateTimeOperator()
- 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 \App\Db\Query
- 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
'less than or equal to' => 'm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedModule' => $relatedModule,
- 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
return $query->column();
- 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
* Queue scheduled workflow tasks.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskRecords = $workflowRecord->getTasks();
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
// at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getEligibleWorkflowRecords($workflow) as $recordId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (true === !empty($taskRecord->getTaskObject()->executeImmediately)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $recordModel->getData();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskQueue->queueTask($taskRecord->getId(), $recordModel->getId(), $delay);
- 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
'in more than' => 'g',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'contains' => 'c',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'days later' => 'e',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is empty' => 'y',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'days ago' => 'e',
- 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
$sourceField = $matches[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => $value,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedFieldName = $matches[3];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition($fieldName, $value, $operator, empty($groupId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sourceField' => $sourceField,
- 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
* Special Date functions.
- 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
// at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$delay = null !== $trigger ? strtotime($data[$trigger['field']]) + $trigger['days'] * 86400 : 0;
- 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 array $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditionMapping = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is' => 'e',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'starts with' => 's',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'more than hours before' => 'l',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addNativeCondition([$queryGenerator->getColumnName('id') => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get eligible workflow records.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$default_timezone = App\Config::main('default_timezone');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskQueue = new VTTaskQueue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adminTimeZone = $admin->time_zone;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
date_default_timezone_set($default_timezone);
- 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
* @param \App\QueryGenerator $queryGenerator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'less than hours before' => 'bw',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operator' => $operator,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['less than days ago', 'more than days ago', 'in less than', 'in more than', 'days ago', 'days later',
- 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 = $this->getWorkflowQuery($workflow);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vtWorflowManager = new VTWorkflowManager();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($taskRecords as $taskRecord) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskRecord->getTaskObject()->doTask($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$trigger = $taskRecord->getTaskObject()->trigger;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addWorkflowConditionsToQueryGenerator(App\QueryGenerator $queryGenerator, $conditions)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'equal to' => 'e',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'greater than or equal to' => 'h',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'more than days ago' => 'l',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
preg_match('/(\w+) : \((\w+)\) (\w+)/', $condition['fieldname'], $matches);
- 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
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
- 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
$vtWorflowManager->updateNexTriggerTime($workflow);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'smallerthannow' => 'smallerthannow',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($operation, $this->specialDateTimeOperator())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = html_entity_decode($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedModule = $matches[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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentTimestamp = date('Y-m-d H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflowRecord = Settings_Workflows_Record_Model::getInstanceFromWorkflowObject($workflow);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskRecord->getTaskObject()->doTask();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledWorkflows = 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
'less than' => 'l',
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
if ('has changed' === $operation || 'not has changed' === $operation || !isset($conditionMapping[$operation])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addRelatedCondition([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedField' => $relatedFieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function parse the value based on the condition.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- 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
$conditions = \App\Json::decode(App\Purifier::decodeHtml($workflow->test));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addWorkflowConditionsToQueryGenerator($queryGenerator, $conditions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEligibleWorkflowRecords($workflow): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
date_default_timezone_set($adminTimeZone);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$delay = null !== $trigger ? strtotime($data[$trigger['field']]) + $trigger['days'] * 86400 : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'in less than' => 'bw',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'less than hours later' => 'bw',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'more than hours later' => 'g',
- 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
$operator = $conditionMapping[$operation];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $condition['fieldname'];
- 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
case 'more than days ago': // less than (current date - givenValue)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'days ago':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'less than hours before':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* User.
- 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
* @param \Workflow $workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($scheduledWorkflows as &$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
'does not contain' => 'k',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'before' => 'l',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($sourceField)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'conditionGroup' => empty($groupId),
- 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 parseValueForDate($condition)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$operation = $condition['operation'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$days = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$days = $condition['value'];
- 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
$scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Record::isExists($recordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'greater than' => 'g',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'nom' => 'nom',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is today' => 'e',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($conditions) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceField = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$operation = $condition['operation'];
- 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
// based on the admin users time zone, since query generator expects datetime at user timezone
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d', strtotime('-' . $days . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d H:i:s') . ',' . date('Y-m-d H:i:s', strtotime('+' . $hours . ' hours'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- 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
$value = date('Y-m-d', strtotime('-' . $days . ' days')) . ',' . date('Y-m-d', strtotime('+1 day'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'in more than': // greater than future date(current date + givenValue)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adminTimeZone = $admin->time_zone;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d', strtotime('-1 day')) . ',' . date('Y-m-d', strtotime('+' . $days . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'more than hours later':
- 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
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'less than days ago': //between current date and (currentdate - givenValue)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d', strtotime('+' . $days . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hours = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d H:i:s', strtotime('-' . $hours . ' hours'));
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
'less than hours before', 'less than hours later', 'more than hours later', 'more than hours before', 'is today', ];
- 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
$days = $condition['value'] - 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- 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
date_default_timezone_set($adminTimeZone);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$days = $condition['value'] - 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$days = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d', strtotime('-' . $days . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'days later':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'less than hours later':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
date_default_timezone_set($default_timezone);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$default_timezone = \App\Config::main('default_timezone');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'is today':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d H:i:s', strtotime('-' . $hours . ' hours')) . ',' . date('Y-m-d H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $condition
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$admin = Users::getActiveAdminUser();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hours = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'in less than': // between current date and future date(current date + givenValue)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hours = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'more than hours before':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d H:i:s', strtotime('+' . $hours . ' hours'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- 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
switch ($operation) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$days = $condition['value'] + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = date('Y-m-d', strtotime('+' . $days . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hours = $condition['value'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
The variable $default_timezone is not named in camelCase. Open
public function parseValueForDate($condition)
{
$value = $condition['value'];
$operation = $condition['operation'];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $default_timezone is not named in camelCase. Open
public function parseValueForDate($condition)
{
$value = $condition['value'];
$operation = $condition['operation'];
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $default_timezone is not named in camelCase. Open
public function queueScheduledWorkflowTasks()
{
$default_timezone = App\Config::main('default_timezone');
$vtWorflowManager = new VTWorkflowManager();
$taskQueue = new VTTaskQueue();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $default_timezone is not named in camelCase. Open
public function queueScheduledWorkflowTasks()
{
$default_timezone = App\Config::main('default_timezone');
$vtWorflowManager = new VTWorkflowManager();
$taskQueue = new VTTaskQueue();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}