Function getNextTriggerTimeForWeekly
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
{
$weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
$currentTime = time();
$currentWeekDay = date('N', $currentTime);
- 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
File Workflow.php
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* +**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
The class Workflow has an overall complexity of 74 which is very high. The configured complexity threshold is 50. Open
class Workflow
{
/**
* Scheduled hourly.
*
- Exclude checks
Function getNextTriggerTimeForMonthlyByDate
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
{
$currentDayOfMonth = date('j', time());
if ($scheduledDayOfMonth) {
$scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
- 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 performTasks
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function performTasks(Vtiger_Record_Model $recordModel, ?array $tasks = null)
{
require_once 'modules/com_vtiger_workflow/VTTaskManager.php';
require_once 'modules/com_vtiger_workflow/VTTaskQueue.php';
- 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
Workflow
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Workflow
{
/**
* Scheduled hourly.
*
Function getNextTriggerTimeForAnnualDates
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
{
if ($annualDates) {
$today = date('Y-m-d');
$annualDates = \App\Json::decode($annualDates);
- 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 getNextTriggerTime
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getNextTriggerTime()
{
$default_timezone = \App\Config::main('default_timezone');
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
Function getNextTriggerTime
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getNextTriggerTime()
{
$default_timezone = \App\Config::main('default_timezone');
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
- 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 getNextTriggerTimeForWeekly
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
{
$weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
$currentTime = time();
$currentWeekDay = date('N', $currentTime);
Method getNextTriggerTimeForMonthlyByDate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
{
$currentDayOfMonth = date('j', time());
if ($scheduledDayOfMonth) {
$scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
Method getNextTriggerTimeForAnnualDates
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
{
if ($annualDates) {
$today = date('Y-m-d');
$annualDates = \App\Json::decode($annualDates);
The method getNextTriggerTime() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function getNextTriggerTime()
{
$default_timezone = \App\Config::main('default_timezone');
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
- 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 getNextTriggerTimeForWeekly() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
{
$weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
$currentTime = time();
$currentWeekDay = date('N', $currentTime);
- 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 performTasks(Vtiger_Record_Model $recordModel, ?array $tasks = null)
- 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
Class "Workflow" has 21 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Workflow
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed. Open
public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
- 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 36 to the 15 allowed. Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
- 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
The class Workflow has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Open
class Workflow
{
/**
* Scheduled hourly.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '186', column '30'). Open
$queryWorkflowTasks = (new \App\Db\Query())->from('com_vtiger_workflowtasks')
- 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 '218', column '13'). Open
$tm = new VTTaskManager();
- 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 '219', 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 '133', column '34'). Open
$this->conditionStrategy = new VTJsonCondition();
- 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 '309', column '15'). Open
return (new DateTimeField($this->schtime))->getDisplayTime();
- 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 '185', column '33'). Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- 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 '389', column '29'). Open
$firstWorkingDay = new DateTime($nextTime);
- 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 '393', column '30'). Open
$firstDayNextWeek = new DateTime('monday next week');
- 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 '397', column '31'). Open
$firstDayNextMonth = new DateTime('first day of next month');
- 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 performTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$delay = 0;
}
- 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 getNextTriggerTimeForMonthlyByWeekDay uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$monthInFullText = date('F', $currentTime);
$yearFullNumberic = date('Y', $currentTime);
if ($scheduledWeekDayOfMonth < $currentDayOfMonth) {
$nextMonth = date('Y-m-d H:i:s', strtotime('first day of next month'));
- 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\Fields\Date' in method 'getNextTriggerTime'. Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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 getNextTriggerTimeForDaily uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$nextTime = date('Y-m-d H:i:s', $todayScheduledTime);
}
- 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\Json' in method 'getNextTriggerTimeForAnnualDates'. Open
$annualDates = \App\Json::decode($annualDates);
- 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 'getNextTriggerTime'. 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\Fields\Date' in method 'getNextTriggerTime'. Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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 getNextTriggerTimeForAnnualDates uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$nextTriggerDay = $annualDates[0];
$nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime . '+1 year'));
}
- 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\Json' in method 'getNextTriggerTimeForMonthlyByDate'. Open
$scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
- 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 'getNextTriggerTime'. 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 getNextTriggerTimeForMonthlyByDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of next month'));
$nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($scheduledDaysOfMonth[0] - 1) . ' days'));
$nextTime = $nextTime . ' ' . $scheduledTime;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method performTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hasContents = $task->hasContents($recordModel);
if ($hasContents) {
$taskQueue->queueTask($task->id, $recordModel->getId(), $delay, $task->getContents($recordModel));
}
- 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 getNextTriggerTimeForWeekly uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));
}
- 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 getNextTriggerTimeForWeekly uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$nextWeekDay = $scheduledDaysOfWeek[$index + 1]; // its the last day of the week i.e. sunday
if (empty($nextWeekDay)) {
$nextWeekDay = $scheduledDaysOfWeek[0];
}
- 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\Json' in method 'getNextTriggerTimeForWeekly'. Open
$scheduledDaysOfWeek = \App\Json::decode($scheduledDaysOfWeek);
- 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\Fields\Date' in method 'getNextTriggerTime'. Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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 "Y:m:d H:i:s" 4 times. Open
$firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of this month'));
- 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.
Add a "case default" clause to this "switch" statement. Open
switch ($this->getWFScheduleType()) {
- Read upRead up
- Exclude checks
The requirement for a final case default
clause is defensive programming. The clause should either take appropriate action, or contain
a suitable comment as to why no action is taken. Even when the switch
covers all current values of an enum
, a default case
should still be used because there is no guarantee that the enum
won't be extended.
Noncompliant Code Example
switch ($param) { //missing default clause case 0: do_something(); break; case 1: do_something_else(); break; } switch ($param) { default: // default clause should be the last one error(); break; case 0: do_something(); break; case 1: do_something_else(); break; }
Compliant Solution
switch ($param) { case 0: do_something(); break; case 1: do_something_else(); break; default: error(); break; }
See
- MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
- MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
- MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
- MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
- MISRA C:2012, 16.1 - All switch statements shall be well-formed
- MISRA C:2012, 16.4 - Every switch statement shall have a default label
- MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
- MITRE, CWE-478 - Missing Default Case in Switch Statement
- CERT, MSC01-C. - Strive for logical completeness
- CERT, MSC01-CPP. - Strive for logical completeness
Define a constant instead of duplicating this literal "+0 day" 3 times. Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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" 14 times. Open
$nextTime = date('Y-m-d H:i:s', strtotime('+5 minutes'));
- 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" 5 times. Open
$this->id = $row['workflow_id'] ?? '';
- 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" 5 times. Open
$scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);
- 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 "first day of next month" 3 times. Open
$firstDayNextMonth = new DateTime('first day of next month');
- 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 "entity_id" 3 times. Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- 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 \Workflow->test
Open
$this->test = $row['test'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->filtersavedinnew
Open
$this->filtersavedinnew = $row['filtersavedinnew'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->nexttrigger_time
Open
$this->nexttrigger_time = $row['nexttrigger_time'] ?? '';
- Exclude checks
Argument 1 (annualDates)
is bool
but \Workflow::getNextTriggerTimeForAnnualDates()
takes \json
defined at /code/modules/com_vtiger_workflow/Workflow.php:568
Open
$nextTime = $this->getNextTriggerTimeForAnnualDates($this->getWFScheduleAnnualDates(), $this->getWFScheduleTime());
- Exclude checks
Parameter $scheduledTime
has undeclared type \time
Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime . '+1 year'));
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
$this->executionCondition = $row['execution_condition'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->schdayofweek
Open
$this->schdayofweek = $row['schdayofweek'] ?? '';
- Exclude checks
Return type of getNextTriggerTimeForWeekly()
is undeclared type \time
Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
- Exclude checks
Assigning array{10:'LBL_5_MINUTES',9:'LBL_15_MINUTES',8:'LBL_30_MINUTES',1:'LBL_HOURLY',2:'LBL_DAILY',3:'LBL_WEEKLY',4:'LBL_SPECIFIC_DATE',5:'LBL_MONTHLY_BY_DATE',6:'LBL_MONTHLY_BY_WEEKDAY',7:'LBL_YEARLY',11:'LBL_WORKINGDAY_DAY',12:'LBL_WORKINGDAY_WEEK',13:'LBL_WORKINGDAY_MONTH'}
to property but \Workflow::$SCHEDULED_LIST
is int[]
Open
public static $SCHEDULED_LIST = [
- Exclude checks
Reference to undeclared property \Workflow->description
Open
$this->description = $row['summary'] ?? '';
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();
- Exclude checks
Reference to undeclared property \Workflow->id
Open
\App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();
- Exclude checks
Argument 1 (time)
is \time
but \DateTime::__construct()
takes ?string
Open
$firstWorkingDay = new DateTime($nextTime);
- Exclude checks
Suspicious type \time
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$nextTriggerWeekDay] . ' ' . $scheduledTime));
- Exclude checks
Reference to undeclared property \Workflow->id
Open
foreach ($tm->getTasksForWorkflow($this->id) as $task) {
- Exclude checks
Parameter $time
has undeclared type \timestamp
Open
public function setNextTriggerTime($time)
- Exclude checks
Reference to undeclared property \Workflow->schtime
Open
return $this->schtime;
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y-m-d H:i:s', strtotime('+1 month ' . $scheduledTime));
- Exclude checks
Reference to undeclared property \Workflow->schtypeid
Open
$this->schtypeid = $row['schtypeid'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->schtypeid
Open
return 6 == $this->executionCondition ? $this->schtypeid : 0;
- Exclude checks
Argument 1 (encodedValue)
is \json
but \App\Json::decode()
takes string
defined at /code/app/Json.php:37
Open
$scheduledDaysOfWeek = \App\Json::decode($scheduledDaysOfWeek);
- Exclude checks
Suspicious type \time
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$weekDay])) . ' ' . $scheduledTime;
- Exclude checks
Returning type null|string
but getNextTriggerTimeForWeekly()
is declared to return \time
Open
return $nextTime;
- Exclude checks
Parameter $scheduledTime
has undeclared type \timestamp
Open
public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
- Exclude checks
Return type of getNextTriggerTimeForAnnualDates()
is undeclared type \time
Open
public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
- Exclude checks
Reference to undeclared property \Workflow->id
Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- Exclude checks
Argument 2 (scheduledTime)
is \timestamp
but \Workflow::getNextTriggerTimeForMonthlyByDate()
takes int
defined at /code/modules/com_vtiger_workflow/Workflow.php:492
Open
$nextTime = $this->getNextTriggerTimeForMonthlyByDate($this->getWFScheduleDay(), $this->getWFScheduleTime());
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();
- Exclude checks
Argument 1 (encodedValue)
is \json
but \App\Json::decode()
takes string
defined at /code/app/Json.php:37
Open
$annualDates = \App\Json::decode($annualDates);
- Exclude checks
Return type of getWFScheduleTime()
is undeclared type \timestamp
Open
public function getWFScheduleTime()
- Exclude checks
Return type of getNextTriggerTime()
is undeclared type \timestamp
Open
public function getNextTriggerTime()
- Exclude checks
Reference to undeclared property \Workflow->conditionStrategy
Open
$this->conditionStrategy = new VTJsonCondition();
- Exclude checks
Reference to undeclared property \Workflow->defaultworkflow
Open
$this->defaultworkflow = $row['defaultworkflow'];
- Exclude checks
Reference to undeclared property \Workflow->test
Open
return $this->conditionStrategy->evaluate($this->test, $recordModel);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$queryWorkflowTasks = (new \App\Db\Query())->from('com_vtiger_workflowtasks')
- Exclude checks
Returning type ?\time|?string
but getNextTriggerTime()
is declared to return \timestamp
Open
return $nextTime;
- Exclude checks
Reference to undeclared property \Workflow->schdayofweek
Open
return $this->schdayofweek;
- Exclude checks
Returning type null|string
but getNextTriggerTimeForAnnualDates()
is declared to return \time
Open
return $nextTime;
- Exclude checks
Reference to undeclared property \Workflow->moduleName
Open
$this->moduleName = $row['module_name'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
return $arr[$this->executionCondition - 1];
- Exclude checks
Return type of getNextTriggerTimeValue()
is undeclared type \timestamp
Open
public function getNextTriggerTimeValue()
- Exclude checks
Reference to undeclared property \Users->time_zone
Open
$adminTimeZone = $admin->time_zone;
- Exclude checks
Suspicious type \time
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));
- Exclude checks
Returning type string
but getNextTriggerTimeForMonthlyByWeekDay()
is declared to return \time
Open
return $nextTime;
- Exclude checks
Reference to undeclared property \Workflow->schdayofmonth
Open
$this->schdayofmonth = $row['schdayofmonth'] ?? '';
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Reference to undeclared property \Workflow->schtime
Open
return (new DateTimeField($this->schtime))->getDisplayTime();
- Exclude checks
Saw an @param annotation for schTime,
but it was not found in the param list of function getNextTriggerTimeForDaily(mixed $scheduledTime) : \time
Open
* @param type $schTime
- Exclude checks
Parameter $scheduledDaysOfWeek
has undeclared type \json
Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
- Exclude checks
Suspicious type \time
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);
- Exclude checks
Reference to undeclared property \Workflow->id
Open
$this->id = $row['workflow_id'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->test
Open
if ('' == $this->test) {
- Exclude checks
Reference to undeclared property \Workflow->conditionStrategy
Open
return $this->conditionStrategy->evaluate($this->test, $recordModel);
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
$this->executionCondition = $arr[$label];
- Exclude checks
Reference to undeclared property \Workflow->nexttrigger_time
Open
$this->nexttrigger_time = $time;
- Exclude checks
Reference to undeclared property \Workflow->executionCondition
Open
return 6 == $this->executionCondition ? $this->schtypeid : 0;
- Exclude checks
Return type of getNextTriggerTimeForDaily()
is undeclared type \time
Open
public function getNextTriggerTimeForDaily($scheduledTime)
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- Exclude checks
Reference to undeclared property \Workflow->nexttrigger_time
Open
return $this->nexttrigger_time;
- Exclude checks
Return type of getNextTriggerTimeForMonthlyByDate()
is undeclared type \time
Open
public function getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
- Exclude checks
Parameter $annualDates
has undeclared type \json
Open
public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$schTime = strtotime($day . ' ' . $scheduledTime);
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime));
- Exclude checks
Reference to undeclared property \Workflow->schannualdates
Open
$this->schannualdates = $row['schannualdates'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->id
Open
->where(['entity_id' => $recordId, 'workflow_id' => $this->id]);
- Exclude checks
Argument 1 (scheduledDaysOfWeek)
is int
but \Workflow::getNextTriggerTimeForWeekly()
takes \json
defined at /code/modules/com_vtiger_workflow/Workflow.php:433
Open
$nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());
- Exclude checks
Argument 2 (scheduledTime)
is \timestamp
but \Workflow::getNextTriggerTimeForWeekly()
takes \time
defined at /code/modules/com_vtiger_workflow/Workflow.php:433
Open
$nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());
- Exclude checks
Returning type string
but getNextTriggerTimeForDaily()
is declared to return \time
Open
return $nextTime;
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y-m-d H:i:s', strtotime($scheduledWeekDayOfMonth . ' ' . $monthInFullText . ' ' . $yearFullNumberic . ' ' . $scheduledTime));
- Exclude checks
Reference to undeclared property \Workflow->schtime
Open
$this->schtime = $row['schtime'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->params
Open
$this->params = $row['params'] ?? '';
- Exclude checks
Reference to undeclared property \Workflow->id
Open
'workflow_id' => $this->id,
- Exclude checks
Reference to undeclared property \Workflow->schdayofmonth
Open
return $this->schdayofmonth;
- Exclude checks
Reference to undeclared property \Workflow->schannualdates
Open
return $this->schannualdates;
- Exclude checks
Suspicious type \timestamp
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();
- Exclude checks
Suspicious type \time
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$nextWeekDay])) . ' ' . $scheduledTime;
- Exclude checks
Parameter $scheduledTime
has undeclared type \timestamp
Open
public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)
- Exclude checks
When fetching an array index from a value of type array{1:'Monday',2:'Tuesday',3:'Wednesday',4:'Thursday',5:'Friday',6:'Saturday',7:'Sunday'},
found an array index of type string,
but expected the index to be of type int
Open
$scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);
- Exclude checks
Argument 1 (encodedValue)
is int
but \App\Json::decode()
takes string
defined at /code/app/Json.php:37
Open
$scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
- Exclude checks
Returning type null|string
but getNextTriggerTimeForMonthlyByDate()
is declared to return \time
Open
return $nextTime;
- Exclude checks
Return type of getNextTriggerTimeForMonthlyByWeekDay()
is undeclared type \time
Open
public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)
- Exclude checks
Avoid excessively long variable names like $SCHEDULED_MONTHLY_BY_DATE. Keep variable name length under 20. Open
public static $SCHEDULED_MONTHLY_BY_DATE = 5;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $isExistsActivateDonce. Keep variable name length under 20. Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $SCHEDULED_WORKINGDAY_DAY. Keep variable name length under 20. Open
public static $SCHEDULED_WORKINGDAY_DAY = 11;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $SCHEDULED_WORKINGDAY_WEEK. Keep variable name length under 20. Open
public static $SCHEDULED_WORKINGDAY_WEEK = 12;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $SCHEDULED_WORKINGDAY_MONTH. Keep variable name length under 20. Open
public static $SCHEDULED_WORKINGDAY_MONTH = 13;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $SCHEDULED_ON_SPECIFIC_DATE. Keep variable name length under 20. Open
public static $SCHEDULED_ON_SPECIFIC_DATE = 4;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $SCHEDULED_MONTHLY_BY_WEEKDAY. Keep variable name length under 20. Open
public static $SCHEDULED_MONTHLY_BY_WEEKDAY = 6;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $scheduleWeekDayInTime. Keep variable name length under 20. Open
$scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $scheduledWeekDayOfMonth. Keep variable name length under 20. Open
public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Workflow
- Exclude checks
The property $SCHEDULED_WEEKLY is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_MONTHLY_BY_WEEKDAY is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_ANNUALLY is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_HOURLY is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_15_MINUTES is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_WORKINGDAY_DAY is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_WORKINGDAY_MONTH is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_MONTHLY_BY_DATE is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_WORKINGDAY_WEEK is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_ON_SPECIFIC_DATE is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_LIST is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_30_MINUTES is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_5_MINUTES is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $SCHEDULED_DAILY is not named in camelCase. Open
class Workflow
{
/**
* Scheduled hourly.
*
- 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 $tm. Configured minimum length is 3. Open
$tm = new VTTaskManager();
- 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
Terminating statement must be indented to the same level as the CASE body Open
break;
- Exclude checks
Terminating statement must be indented to the same level as the CASE body Open
break;
- Exclude checks
The 'getWFScheduleAnnualDates()' method which returns a boolean should be named 'is...()' or 'has...()' Open
public function getWFScheduleAnnualDates()
{
return $this->schannualdates;
}
- Read upRead up
- Exclude checks
BooleanGetMethodName
Since: 0.2
Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.
Example
class Foo {
/**
* @return boolean
*/
public function getFoo() {} // bad
/**
* @return bool
*/
public function isFoo(); // ok
/**
* @return boolean
*/
public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}
Source https://phpmd.org/rules/naming.html#booleangetmethodname
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
* Scheduled annually.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Scheduled weekly.
- 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
* Scheduled on specific date.
- 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
public static $SCHEDULED_30_MINUTES = 8;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $SCHEDULED_WORKINGDAY_DAY = 11;
- 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
public static $SCHEDULED_WEEKLY = 3;
- 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
* Scheduled monthly by weekday.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Scheduled first working day in week.
- 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
* Scheduled first working day in month.
- 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
* Scheduled hourly.
- 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
public static $SCHEDULED_ON_SPECIFIC_DATE = 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
*
- 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
* Scheduled closest working day.
- 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 $SCHEDULED_DAILY = 2;
- 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
* @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
* Scheduled list.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Scheduled hourly.
- 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 $SCHEDULED_MONTHLY_BY_DATE = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Scheduled hourly.
- 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 $SCHEDULED_15_MINUTES = 9;
- 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
* @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 $SCHEDULED_WORKINGDAY_WEEK = 12;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $SCHEDULED_WORKINGDAY_MONTH = 13;
- 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
* Scheduled monthly by date.
- 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 $SCHEDULED_ANNUALLY = 7;
- 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
* Scheduled daily.
- 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
* @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
* Scheduled hourly.
- 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 $SCHEDULED_HOURLY = 1;
- 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
* @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 static $SCHEDULED_MONTHLY_BY_WEEKDAY = 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
*
- 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 $SCHEDULED_5_MINUTES = 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
11 => 'LBL_WORKINGDAY_DAY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
13 => 'LBL_WORKINGDAY_MONTH',
- 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
$this->schtime = $row['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
return !(!$isExistsActivateDonce && !$queryWorkflowTasks->exists());
- 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
return $arr[$this->executionCondition - 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
public static $SCHEDULED_LIST = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params = $row['params'] ?? '';
- 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
* Setup workflow.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($row['defaultworkflow'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isCompletedForRecord($recordId)
- 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
$this->executionCondition = $arr[$label];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
9 => 'LBL_15_MINUTES',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->conditionStrategy = new VTJsonCondition();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->schannualdates = $row['schannualdates'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->nexttrigger_time = $row['nexttrigger_time'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- 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 performTasks(Vtiger_Record_Model $recordModel, ?array $tasks = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tm->getTasksForWorkflow($this->id) as $task) {
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$taskQueue->queueTask($task->id, $recordModel->getId(), $delay, $task->getContents($recordModel));
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$arr = ['ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE', 'ON_MODIFY', 'ON_DELETE', 'ON_SCHEDULE', 'MANUAL', 'TRIGGER', 'BLOCK_EDIT', 'ON_RELATED'];
- 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->schtypeid = $row['schtypeid'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' == $this->test) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
'ON_DELETE' => 5, 'ON_SCHEDULE' => 6, 'MANUAL' => 7, 'TRIGGER' => 8, 'BLOCK_EDIT' => 9, 'ON_RELATED' => 10, ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tm = new VTTaskManager();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($hasContents) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$arr = ['ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE', 'ON_MODIFY', 'ON_DELETE', 'ON_SCHEDULE', 'MANUAL', 'TRIGGER', 'BLOCK_EDIT', 'ON_RELATED'];
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->id = $row['workflow_id'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Evaluate.
- 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 markAsCompletedForRecord($recordId)
- 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
}
- 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 string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function executionConditionAsLabel($label = null)
- 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 function 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
public function evaluate($recordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- 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
'entity_id' => $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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
8 => 'LBL_30_MINUTES',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
2 => 'LBL_DAILY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
12 => 'LBL_WORKINGDAY_WEEK',
- 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->test = $row['test'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if workfow is completed for record.
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
->innerJoin('com_vtiger_workflowtask_queue', 'com_vtiger_workflowtasks.task_id= com_vtiger_workflowtask_queue.task_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
$taskQueue = new VTTaskQueue();
- 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 (null === $label) {
- 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
5 => 'LBL_MONTHLY_BY_DATE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
4 => 'LBL_SPECIFIC_DATE',
- 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
Line exceeds 120 characters; contains 171 characters Open
$isExistsActivateDonce = (new \App\Db\Query())->from('com_vtiger_workflow_activatedonce')->where(['entity_id' => $recordId, 'workflow_id' => $this->id])->exists();
- 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 int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['entity_id' => $recordId, 'workflow_id' => $this->id]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/VTTaskQueue.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hasContents = $task->hasContents($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->insert('com_vtiger_workflow_activatedonce', [
- 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
* Execution condition as label.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $label
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param timestamp $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($task->active && (null === $tasks || \in_array($task->id, $tasks))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$delay = 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
1 => 'LBL_HOURLY',
- 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 $row
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->moduleName = $row['module_name'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->schdayofmonth = $row['schdayofmonth'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->schdayofweek = $row['schdayofweek'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->conditionStrategy->evaluate($this->test, $recordModel);
- 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 array|null $tasks
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require_once 'modules/com_vtiger_workflow/VTTaskManager.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskQueue->queueTask($task->id, $recordModel->getId(), $delay, $task->getContents($recordModel));
- 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
$arr = ['ON_FIRST_SAVE' => 1, 'ONCE' => 2, 'ON_EVERY_SAVE' => 3, 'ON_MODIFY' => 4,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ON_DELETE' => 5, 'ON_SCHEDULE' => 6, 'MANUAL' => 7, 'TRIGGER' => 8, 'BLOCK_EDIT' => 9, '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
$this->description = $row['summary'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->defaultworkflow = $row['defaultworkflow'];
- 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
$queryWorkflowTasks = (new \App\Db\Query())->from('com_vtiger_workflowtasks')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('com_vtiger_workflowtask_queue', 'com_vtiger_workflowtasks.task_id= com_vtiger_workflowtask_queue.task_id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (true === (bool) $task->executeImmediately && 0 === $delay) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task->doTask($recordModel);
- 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
10 => 'LBL_5_MINUTES',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
3 => 'LBL_WEEKLY',
- 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
6 => 'LBL_MONTHLY_BY_WEEKDAY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->filtersavedinnew = $row['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
* Perform tasks.
- 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 (null !== $trigger) {
- 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
$delay = strtotime($recordModel->get($trigger['field'])) + $trigger['days'] * 86400;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->executionCondition = $row['execution_condition'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sets next trigger time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Record_Model $recordModel
- 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 true;
- 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
'workflow_id' => $this->id,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
7 => 'LBL_YEARLY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Mark workflow as completed for record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$trigger = $task->trigger;
- 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 setNextTriggerTime($time)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->schtime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->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
switch ($this->getWFScheduleType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_WEEKLY:
- 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
$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
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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWFScheduleWeek()
- 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 self::$SCHEDULED_WORKINGDAY_WEEK:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->nexttrigger_time = $time;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->nexttrigger_time;
- 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
* Return workflow schedule timestamp.
- 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 workflow schedule week.
- 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 getNextTriggerTime()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_DAILY:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', strtotime('+10 year'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = $this->getNextTriggerTimeForAnnualDates($this->getWFScheduleAnnualDates(), $this->getWFScheduleTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return timestamp
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->schdayofmonth;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return timestamp
- 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($adminTimeZone);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', strtotime('+1 hour'));
- 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
\App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->execute();
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
\App\Db::getInstance()->createCommand()->update('com_vtiger_workflows', ['nexttrigger_time' => $time], ['workflow_id' => $this->id])->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
$nextTime = null;
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$nextTime = $this->getNextTriggerTimeForMonthlyByDate($this->getWFScheduleDay(), $this->getWFScheduleTime());
- 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 workflow schedule timestamp in user format.
- 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
$nextTime = date('Y-m-d H:i:s', strtotime('+5 minutes'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_HOURLY:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = $this->getNextTriggerTimeForDaily($this->getWFScheduleTime());
- 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
Line exceeds 120 characters; contains 136 characters Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* get next trigger time for daily.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $scheduledTime
- 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 getNextTriggerTimeForDaily($scheduledTime)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return next trigger timestamp.
- 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 string
- 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 getWFScheduleAnnualDates()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function gets the next trigger for the workflows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_5_MINUTES:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_MONTHLY_BY_WEEKDAY:
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$nextTime = $this->getNextTriggerTimeForMonthlyByWeekDay($this->getWFScheduleDay(), $this->getWFScheduleTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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 getNextTriggerTimeValue()
- 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 getWFScheduleTimeUserFormat()
- 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
Line exceeds 120 characters; contains 123 characters Open
$nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$nextTime = $this->getNextTriggerTimeForAnnualDates($this->getWFScheduleAnnualDates(), $this->getWFScheduleTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextWeek, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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
return $this->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
case self::$SCHEDULED_30_MINUTES:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = $this->getNextTriggerTimeForMonthlyByWeekDay($this->getWFScheduleDay(), $this->getWFScheduleTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_ANNUALLY:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstDayNextWeek = new DateTime('monday next week');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $nextTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new DateTimeField($this->schtime))->getDisplayTime();
- 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
case self::$SCHEDULED_ON_SPECIFIC_DATE:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_MONTHLY_BY_DATE:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = $this->getNextTriggerTimeForMonthlyByDate($this->getWFScheduleDay(), $this->getWFScheduleTime());
- 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
* @return timestamp
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return schedule type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 6 == $this->executionCondition ? $this->schtypeid : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- 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
* @global string $default_timezone
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_15_MINUTES:
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($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
* Return workflow schedule day.
- 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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_WORKINGDAY_DAY:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstDayNextMonth = new DateTime('first day of next month');
- 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 workflow schedule annual dates.
- 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
$nextTime = date('Y-m-d H:i:s', strtotime('+30 minutes'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstWorkingDay = new DateTime($nextTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstDayNextMonth, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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
$nextTime = date('Y-m-d H:i:s', strtotime('+15 minutes'));
- 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
$nextTime = $this->getNextTriggerTimeForWeekly($this->getWFScheduleWeek(), $this->getWFScheduleTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::$SCHEDULED_WORKINGDAY_MONTH:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $schTime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$now = strtotime(date('Y-m-d H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param time $scheduledTime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getNextTriggerTimeForWeekly($scheduledDaysOfWeek, $scheduledTime)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTriggerWeekDay = $weekDay;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$nextTriggerWeekDay] . ' ' . $scheduledTime));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($nextTriggerDay - 1) . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of next month'));
- 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
$currentTime = time();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledTime = $this->getWFScheduleTime();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $nextTime;
- 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 getWFScheduleType()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWFScheduleTime()
- 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 getWFScheduleDay()
- 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
$nextTime = $this->getNextTriggerTimeForDaily($this->getWFScheduleTime());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = \App\Fields\Date::getWorkingDayFromDate($firstWorkingDay, '+0 day') . ' ' . $this->getWFScheduleTime();
- 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
$nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$weekDay])) . ' ' . $scheduledTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));
- 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 (\is_array($scheduledDaysOfMonth)) {
- 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
$nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($nextTriggerDay - 1) . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($scheduledWeekDayOfMonth == $currentDayOfMonth) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($currentTime < $scheduleWeekDayInTime) { //if the scheduled time is greater than current time, selected today
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$nextWeekDay])) . ' ' . $scheduledTime;
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$nextWeekDay])) . ' ' . $scheduledTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($weekDay > $currentWeekDay) {
- 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 getNextTriggerTimeForMonthlyByDate($scheduledDayOfMonth, $scheduledTime)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentTime = time();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($schTime > $currentTime) {
- 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
$nextTime = $nextTime . ' ' . $scheduledTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($scheduledWeekDayOfMonth < $currentDayOfMonth) {
- 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 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
* @return time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$todayScheduledTime = strtotime(date('Y-m-d H:i:s', strtotime($scheduledTime)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* get next trigger Time For weekly.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentWeekDay = date('N', $currentTime);
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
if ($currentTime < $scheduleWeekDayInTime) { //if the scheduled time is greater than current time, selected today
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$nextWeekDay = $scheduledDaysOfWeek[$index + 1]; // its the last day of the week i.e. sunday
- 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
sort($scheduledDaysOfMonth);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($day == $currentDayOfMonth) {
- 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
$nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($scheduledDaysOfMonth[0] - 1) . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', strtotime('+1 day ' . $scheduledTime));
- 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
$nextWeekDay = $scheduledDaysOfWeek[$index + 1]; // its the last day of the week i.e. sunday
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextWeekDay = $scheduledDaysOfWeek[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
* get next triggertime for monthly.
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$nextTime = date('Y:m:d', strtotime($firstDayofNextMonth . ' + ' . ($scheduledDaysOfMonth[0] - 1) . ' days'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', strtotime('+1 month ' . $scheduledTime));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $nextTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledDaysOfWeek = \App\Json::decode($scheduledDaysOfWeek);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 == \count($scheduledDaysOfWeek)) { //if only one weekday selected, then get next week
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($nextWeekDay)) {
- 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
$nextTriggerDay = $day;
- 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
* to get next trigger time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTriggerWeekDay = $weekDay;
- 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 time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($scheduledDayOfMonth) {
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
1. First sort all the days in ascending order and find the closest day which is greater than currentDayOfMonth
- 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
$monthInFullText = date('F', $currentTime);
- 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
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$scheduledDaysOfWeek[0]] . ' ' . $scheduledTime));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDayOfMonth = date('j', time());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = $nextTime . ' ' . $scheduledTime;
- 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
$weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($scheduledDaysOfWeek) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$nextTime = date('Y-m-d H:i:s', strtotime($weekDays[$nextTriggerWeekDay] . ' ' . $scheduledTime));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $nextTime;
- 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
$nextTriggerDay = $day;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($nextTriggerDay)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextMonth = date('Y-m-d H:i:s', strtotime('first day of next month'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', strtotime($scheduledWeekDayOfMonth . ' ' . $monthInFullText . ' ' . $yearFullNumberic . ' ' . $scheduledTime));
- 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
$nextTriggerWeekDay = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($scheduledDaysOfWeek as $index => $weekDay) {
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);
- 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
* @param int $scheduledTime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($scheduledDaysOfMonth as $day) {
- 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
$monthInFullText = date('F', strtotime($nextMonth));
- 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
}
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$weekDays = ['1' => 'Monday', '2' => 'Tuesday', '3' => 'Wednesday', '4' => 'Thursday', '5' => 'Friday', '6' => 'Saturday', '7' => 'Sunday'];
- 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 ($weekDay == $currentWeekDay) { //if today is the weekday selected
- 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
$nextTriggerDay = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstDayofNextMonth = date('Y:m:d H:i:s', strtotime('first day of this month'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $scheduledWeekDayOfMonth
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getNextTriggerTimeForMonthlyByWeekDay($scheduledWeekDayOfMonth, $scheduledTime)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$yearFullNumberic = date('Y', $currentTime);
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$nextTime = date('Y-m-d H:i:s', strtotime($scheduledWeekDayOfMonth . ' ' . $monthInFullText . ' ' . $yearFullNumberic . ' ' . $scheduledTime));
- 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 json $scheduledDaysOfWeek
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentTime = time();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($scheduledDaysOfWeek)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduleWeekDayInTime = strtotime(date('Y-m-d', strtotime($weekDays[$currentWeekDay])) . ' ' . $scheduledTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$scheduledDaysOfMonth = \App\Json::decode($scheduledDayOfMonth);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($day > $currentDayOfMonth) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param timestamp $scheduledTime
- 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 ($now > $todayScheduledTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
1. First sort all the weekdays(stored as 0,1,2,3 etc in db) and find the closest weekday which is greater than currentWeekDay
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//current time greater than scheduled time, get the next weekday
- 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
if (!empty($nextTriggerWeekDay)) {
- 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
* to get next trigger time for weekday of the month.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y-m-d H:i:s', $todayScheduledTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
sort($scheduledDaysOfWeek);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$nextTime = date('Y-m-d', strtotime('next ' . $weekDays[$weekDay])) . ' ' . $scheduledTime;
- 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
if (!isset($nextTime)) {
- 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 int $scheduledDayOfMonth
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schTime = strtotime(date('Y') . '-' . date('m') . '-' . $day . ' ' . $scheduledTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $nextTime;
- 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
$currentDayOfMonth = date('j', $currentTime);
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($annualDates) {
- 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
$nextTriggerDay = $annualDates[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
foreach ($annualDates as $day) {
- 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
* @param json $annualDates
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentTime = time();
- 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
$annualDates = \App\Json::decode($annualDates);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// sort the dates
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schTime = strtotime($day . ' ' . $scheduledTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param timestamp $scheduledTime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTriggerDay = $day;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentDayOfMonth = date('Y-m-d', $currentTime);
- 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 ($schTime > $currentTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTriggerDay = $day;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $nextTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTriggerDay = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($nextTriggerDay)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime . '+1 year'));
- 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 ($day == $currentDayOfMonth) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($day > $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
$today = date('Y-m-d');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getNextTriggerTimeForAnnualDates($annualDates, $scheduledTime)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
sort($annualDates);
- 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
$nextTime = date('Y:m:d H:i:s', strtotime($nextTriggerDay . ' ' . $scheduledTime));
- Exclude checks
Line indented incorrectly; expected 28 spaces, found 32 Open
}
- Exclude checks
Line indented incorrectly; expected 24 spaces, found 28 Open
}
- Exclude checks
Line indented incorrectly; expected 28 spaces, found 32 Open
if (empty($nextWeekDay)) {
- Exclude checks
Line indented incorrectly; expected 24 spaces, found 28 Open
if (1 == \count($scheduledDaysOfWeek)) { //if only one weekday selected, then get next week
- Exclude checks
Line indented incorrectly; expected 24 spaces, found 28 Open
} else {
- Exclude checks
The variable $default_timezone is not named in camelCase. Open
public function getNextTriggerTime()
{
$default_timezone = \App\Config::main('default_timezone');
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
- 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 getNextTriggerTime()
{
$default_timezone = \App\Config::main('default_timezone');
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
- 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();
}
}