final class Simple_Timer extends Timer

A Timer instance that bases it's run times off of even intervals from a specified start times. It can also return how many missed intervals a Timer may potentially have.

Properties

protected Action[] $Actions from  Timer
protected array $actions_data from  Timer
string $id from  Timer
int $last_run from  Timer
array $timer_created from  Timer
array $timer_type from  Timer
int $multiplier
string $interval

Methods

static 
print_form(string $group)

The inherited abstract function for printing the output for the Form Builder.

get_next_run()

Return the \DateTime instance that represents the next time the Interval Timer is supposed to be run.

static string
timer_label()

Get the Timer name.

static string
timer_type_id()

Get the Timer type ID.

array
export_array()

The inherited abstract for exporting the properties created by this class.

print_info()

The inherited abstract for printing Timer info.

get_created()

Get the creation DateTime in GMT.

from  Timer
null|DateTime
get_last_run()

Get the last run time. Returns in GMT.

from  Timer
Action[]
get_actions()

Get the Actions.

from  Timer
__construct(string $timer_id, array $options)

Construct the Interval Timer.

maybe_run_timer()

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

from  Timer
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.

from  Timer
null|Action
get_action(string $action_id)

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

from  Timer
bool
has_action(string $action_id)

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

from  Timer
bool
save(bool $merge = false)

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

from  Timer
merge_actions(Timer $Timer)

Merge Actions from another Timer instance into this instance.

from  Timer
array
to_array()

Convert this object into an array for export/import.

from  Timer
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.

from  Timer
static array
get_interval_types()

Get the interval types.

int
get_interval_value()

Get the value in seconds of the interval type of this Interval Timer.

Details

at line 108
final static print_form(string $group)

The inherited abstract function for printing the output for the Form Builder.

Parameters

string $group

The form name to use when building the form.

at line 117
final DateTime get_next_run()

Return the \DateTime instance that represents the next time the Interval Timer is supposed to be run.

Return Value

DateTime

The next run time.

at line 60
final static string timer_label()

Get the Timer name.

Return Value

string

The formal name of the Timer.

at line 67
final static string timer_type_id()

Get the Timer type ID.

Return Value

string

A slug that represents the timer class.

at line 143
final protected array export_array()

The inherited abstract for exporting the properties created by this class.

Return Value

array

The exportable properties and values of the super class.

at line 162
final print_info()

The inherited abstract for printing Timer info.

in Timer at line 100
final DateTime get_created()

Get the creation DateTime in GMT.

Return Value

DateTime

The creation DateTime.

in Timer 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.

in Timer at line 124
final Action[] get_actions()

Get the Actions.

Return Value

Action[]

The Actions.

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

Construct the Interval Timer.

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.

in Timer at line 174
final maybe_run_timer()

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

in Timer 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.

in Timer 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.

in Timer 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.

in Timer 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.

in Timer 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.

in Timer 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.

in 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.

at line 53
final static array get_interval_types()

Get the interval types.

Return Value

array

The interval types.

at line 134
final int get_interval_value()

Get the value in seconds of the interval type of this Interval Timer.

Return Value

int

The value in seconds of the given interval type.