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

static 
print_form(string $group)

Abstract function to print form options for the form builder.

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.

static string
timer_label()

Abstract function for holding a printable timer name for the Form Builder.

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.

array
export_array()

Abstract function to cover the exporting of properties of super classes in { $this->to_array() }

print_info()

Abstract function to print a table of the Timer's useful information.

get_created()

Get the creation DateTime in GMT.

null|DateTime
get_last_run()

Get the last run time. Returns in GMT.

Action[]
get_actions()

Get the Actions.

__construct(string $timer_id, array $options)

Construct a Timer given an ID and a set of options.

maybe_run_timer()

Check if the Timers next run time is past and fire the run function if it is.

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.

null|Action
get_action(string $action_id)

Return an Action instance from this Timer, if it exists, else return NULL.

bool
has_action(string $action_id)

Check whether an action exists in { $this->action_data }.

bool
save(bool $merge = false)

A wrapper function for \WPPF\v1_2_2\Plugin\Action_Scheduler\Timer_Manager::update_timer().

merge_actions(Timer $Timer)

Merge Actions from another Timer instance into this instance.

array
to_array()

Convert this object into an array for export/import.

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.

Details

at line 60
abstract static print_form(string $group)

Abstract function to print form options for the form builder.

Parameters

string $group

The form name to use when building the form.

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.

Return Value

DateTime

The next run time.

at line 74
abstract static string timer_label()

Abstract function for holding a printable timer name for the Form Builder.

Return Value

string

The formal name of the Timer.

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.

Return Value

string

A slug that represents the timer class.

at line 88
abstract protected array export_array()

Abstract function to cover the exporting of properties of super classes in { $this->to_array() }

Return Value

array

The exportable properties and values of the super class.

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.

Return Value

DateTime

The creation DateTime.

at line 109
final null|DateTime get_last_run()

Get the last run time. Returns in GMT.

Return Value

null|DateTime

The last run time.

at line 124
final Action[] get_actions()

Get the Actions.

Return Value

Action[]

The Actions.

at line 132
__construct(string $timer_id, array $options)

Construct a Timer given an ID and a set of options.

Parameters

string $timer_id

The ID of the Timer to construct.

array $options

A list of options to provide the Timer and it's super-class constructors.

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.

Parameters

Action $Action

The Action to try and add.

bool $update

Whether or not to replace the Action if it already exists by ID (default FALSE)

Return Value

bool

Whether or not the action was added.

at line 223
final null|Action get_action(string $action_id)

Return an Action instance from this Timer, if it exists, else return NULL.

Parameters

string $action_id

The ID of the Action to look for.

Return Value

null|Action

The Action instance or NULL.

at line 238
final bool has_action(string $action_id)

Check whether an action exists in { $this->action_data }.

Parameters

string $action_id

The ID of the Action to search for.

Return Value

bool

Whether the Action exists or not.

at line 249
final bool save(bool $merge = false)

A wrapper function for \WPPF\v1_2_2\Plugin\Action_Scheduler\Timer_Manager::update_timer().

Parameters

bool $merge

Whether or not to merge existing Actions if the Timer already exists.

Return Value

bool

Whether or not the option meta was persisted.

at line 268
final merge_actions(Timer $Timer)

Merge Actions from another Timer instance into this instance.

Parameters

Timer $Timer

The Timer instance to merge Actions from.

at line 279
final array to_array()

Convert this object into an array for export/import.

Return Value

array

The array representation of this Timer.

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.

Parameters

string $timer_id

The ID of the Timer.

array $timer_options

Return Value

null|Timer

The timer that was instantiated or FALSE.