Timer
abstract class Timer
A Timer template for the Action Scheduler system that other timer classes can extend and implement their own settings for.
Properties
| protected Action[] | $Actions | ||
| protected array | $actions_data | ||
| string | $id | ||
| int | $last_run | ||
| array | $timer_created | ||
| array | $timer_type |
Methods
Abstract function to print form options for the form builder.
Abstract function which returns a timestamp of when the last run of Actions is/was supposed to be. This allows timers to implement their own system for deciding the timer sequence without being bound to a static interval.
Abstract function for holding a printable timer name for the Form Builder.
Abstract function that returns a slug which represents the timer class, this way timers can be reinstantiated from the database across Framework versions.
Abstract function to cover the exporting of properties of super classes in { $this->to_array() }
Abstract function to print a table of the Timer's useful information.
Get the creation DateTime in GMT.
Get the last run time. Returns in GMT.
Get the Actions.
Construct a Timer given an ID and a set of options.
Check if the Timers next run time is past and fire the run function if it is.
Add an Action to the Timer instance, optionally update the Action and { $this->action_data } if it already exists.
Return an Action instance from this Timer, if it exists, else return NULL.
Check whether an action exists in { $this->action_data }.
A wrapper function for \WPPF\v1_2_2\Plugin\Action_Scheduler\Timer_Manager::update_timer().
Convert this object into an array for export/import.
Attempt to create a Timer super class instance using the 'timer_class' property associated with the Timer.
Details
at line 60
abstract static
print_form(string $group)
Abstract function to print form options for the form builder.
at line 67
abstract DateTime
get_next_run()
Abstract function which returns a timestamp of when the last run of Actions is/was supposed to be. This allows timers to implement their own system for deciding the timer sequence without being bound to a static interval.
at line 74
abstract static string
timer_label()
Abstract function for holding a printable timer name for the Form Builder.
at line 81
abstract static string
timer_type_id()
Abstract function that returns a slug which represents the timer class, this way timers can be reinstantiated from the database across Framework versions.
at line 88
abstract protected array
export_array()
Abstract function to cover the exporting of properties of super classes in { $this->to_array() }
at line 93
abstract
print_info()
Abstract function to print a table of the Timer's useful information.
at line 100
final DateTime
get_created()
Get the creation DateTime in GMT.
at line 109
final null|DateTime
get_last_run()
Get the last run time. Returns in GMT.
at line 124
final Action[]
get_actions()
Get the Actions.
at line 132
__construct(string $timer_id, array $options)
Construct a Timer given an ID and a set of options.
at line 174
final
maybe_run_timer()
Check if the Timers next run time is past and fire the run function if it is.
at line 206
final bool
add_action(Action $Action, bool $update = false)
Add an Action to the Timer instance, optionally update the Action and { $this->action_data } if it already exists.
at line 223
final null|Action
get_action(string $action_id)
Return an Action instance from this Timer, if it exists, else return NULL.
at line 238
final bool
has_action(string $action_id)
Check whether an action exists in { $this->action_data }.
at line 249
final bool
save(bool $merge = false)
A wrapper function for \WPPF\v1_2_2\Plugin\Action_Scheduler\Timer_Manager::update_timer().
at line 268
final
merge_actions(Timer $Timer)
Merge Actions from another Timer instance into this instance.
at line 279
final array
to_array()
Convert this object into an array for export/import.
at line 303
final static null|Timer
instantiate_timer(string $timer_id, array $timer_options)
Attempt to create a Timer super class instance using the 'timer_class' property associated with the Timer.