BaseProcessor
- Full name:
\Codefy\Framework\Scheduler\Processor\BaseProcessor
- This class implements:
\Codefy\Framework\Scheduler\Processor\Processor
- This class is an Abstract class
Properties
mutex
command
description
timezone
args
filters
rejects
beforeCallbacks
afterCallbacks
runInBackground
preventOverlapping
expiresAfter
Methods
__construct
public __construct(\Codefy\Framework\Scheduler\Mutex\Locker $mutex, callable|string $command, ?array $args = null, \DateTimeZone|string|null $timezone = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$mutex | \Codefy\Framework\Scheduler\Mutex\Locker | |
$command | callable|string | |
$args | ?array | |
$timezone | \DateTimeZone|string|null |
mutexName
Unique name to use for a mutually exclusive lock.
withArgs
Set arguments for the command.
Parameters:
Parameter | Type | Description |
---|---|---|
$args | array|null |
description
Set a command description.
Parameters:
Parameter | Type | Description |
---|---|---|
$description | string |
runCommandInForeground
runCommandInBackground
runInForeground
Force the command to run in foreground.
canRunCommandInBackground
Check if the command can run in background.
callBeforeCallbacks
Call all the before callbacks for the command.
callAfterCallbacks
Call all the after callbacks for the command.
when
Truth test to determine if a command should run when it is due.
Parameters:
Parameter | Type | Description |
---|---|---|
$callback | callable|bool |
skip
Truth test to determine if a command should run when it is due.
Parameters:
Parameter | Type | Description |
---|---|---|
$callback | callable|bool |
before
Set a function to be called before a command is executed.
Parameters:
Parameter | Type | Description |
---|---|---|
$fn | callable |
after
Set a function to be called after a command is executed.
Parameters:
Parameter | Type | Description |
---|---|---|
$fn | callable |
then
Set a function to be called after a command is executed.
Parameters:
Parameter | Type | Description |
---|---|---|
$fn | callable | |
$runInBackground | bool |
onlyOneInstance
Prevents commands from overlapping.
Parameters:
Parameter | Type | Description |
---|---|---|
$expiresAfter | int | The amount of time in seconds the mutex lock should live. |
canRunOnlyOneInstance
Check if process con only have one instance.
maxRuntime
getExpression
Gets the current cron expression for the task.
isDue
Determine if the given command should run based on the Cron expression.
Parameters:
Parameter | Type | Description |
---|---|---|
$timeZone | string|\DateTimeZone|null |
Throws:
compile
Compile the Task command.
getCommand
Returns the command.
Inherited methods
cron
The Cron expression representing the task's frequency.
Parameters:
Parameter | Type | Description |
---|---|---|
$expression | string |
Throws:
filtersPass
Determine if the filters pass.
between
Schedule task to run between start and end time.
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | string | |
$endTime | string |
unlessBetween
Schedule task that doesn't fall between start and end time.
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | string | |
$endTime | string |
inTimeInterval
Schedule task to run between start and end time.
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | string | |
$endTime | string |
hourly
Schedule the task to run hourly.
Parameters:
Parameter | Type | Description |
---|---|---|
$minute | int|string |
Throws:
daily
Schedule the task to run daily.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
on
Schedule the task to run on a certain date.
Parameters:
Parameter | Type | Description |
---|---|---|
$date | string |
Throws:
at
Schedule the command at a given time.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
dailyAt
Schedule the task to run daily at a given time (10:00, 19:30, etc).
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
twiceDaily
Schedule the task to run twice daily.
Parameters:
Parameter | Type | Description |
---|---|---|
$first | int | First hour. |
$second | int | Second hour. |
Throws:
twiceDailyAt
Schedule the task to run twice daily at a given minute.
Parameters:
Parameter | Type | Description |
---|---|---|
$first | int | First hour. |
$second | int | Second hour. |
$minute | int | Minute. |
Throws:
weekdays
Schedule the task to run only on weekdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
weekends
Schedule the task to run only on weekdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
mondays
Schedule the task to run only on Mondays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
tuesdays
Schedule the task to run only on Tuesdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
wednesdays
Schedule the task to run only on Wednesdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
thursdays
Schedule the task to run only on Thursdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
fridays
Schedule the task to run only on Fridays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
saturdays
Schedule the task to run only on Saturdays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
sundays
Schedule the task to run only on Sundays.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | ?string |
Throws:
weekly
Schedule the task to run weekly.
Throws:
weeklyOn
Schedule the task to run weekly on a given day and time.
Parameters:
Parameter | Type | Description |
---|---|---|
$day | int|string | |
$time | string |
Throws:
monthly
Schedule the task to run monthly.
Throws:
monthlyOn
Schedule the task to run monthly on a given day and time.
Parameters:
Parameter | Type | Description |
---|---|---|
$dayOfMonth | int|string | |
$time | string |
Throws:
lastDayOfTheMonth
Schedule the task to run monthly on a given day and time.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | string |
Throws:
quarterly
Schedule the task to run quarterly.
Parameters:
Parameter | Type | Description |
---|---|---|
$day | int|string|array | |
$time | ?string |
Throws:
yearly
Schedule the task to run yearly.
Throws:
yearlyOn
Schedule the task to run yearly.
Parameters:
Parameter | Type | Description |
---|---|---|
$month | int | |
$day | int | |
$time | ?string |
Throws:
days
Set the days of the week the command should run on.
Parameters:
Parameter | Type | Description |
---|---|---|
$days | mixed |
Throws:
hour
Set hour for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
minute
Set minute for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
dayOfMonth
Set day of the month for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
month
Set month for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
dayOfWeek
Set dah of the week for the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed |
Throws:
timezone
Set the timezone the date should be evaluated on.
Parameters:
Parameter | Type | Description |
---|---|---|
$timezone | \DateTimeZone|string |
every
Another way to the frequency of the cron job.
Parameters:
Parameter | Type | Description |
---|---|---|
$unit | string|null | (minute, hour, day, month or weekday) |
$value | float|int|null |
Throws:
everyMinute
Schedule task to run every minute of every $minute minutes.
Parameters:
Parameter | Type | Description |
---|---|---|
$minute | string|int |
Throws:
everyHour
Schedule task to run every hour or every $hour hour and $minute minutes.
Parameters:
Parameter | Type | Description |
---|---|---|
$hour | string|int | |
$minute | int |
Throws:
expressionPasses
Determine if the Cron expression passes.
Parameters:
Parameter | Type | Description |
---|---|---|
$timezone | string|\DateTimeZone|null |
Throws:
spliceIntoPosition
Splice the given value into the given position of the expression.
Parameters:
Parameter | Type | Description |
---|---|---|
$position | int | |
$value | string |
Throws:
setDayOfWeek
Internal function used by the everyMonday, etc functions.
Parameters:
Parameter | Type | Description |
---|---|---|
$day | int|string | |
$time | ?string |
Throws:
parseTime
Parses a time string (like 4:08 pm) into minutes and hours.
Parameters:
Parameter | Type | Description |
---|---|---|
$time | string |
Automatically generated on 2025-10-13