FixerIO_Task
extends Task
in package
Cron task abstract class.
Concrete implementations of a task must extend this and implement run();
Applications can use $this->log() for logging.
Table of Contents
- $name : mixed
- $priority : mixed
- $task_start_time : mixed
- $timeout : mixed
- $verbose : mixed
- $api_key : string|null
- Fixer IO API key, retrieved from DB.
- $currencies_list : array<string|int, mixed>
- List of fixer currencies as retrieved from /symbols API endpoint, minus the Bitcoin currency.
- $enabled_symbols : array<string|int, mixed>
- List of fixer symbols that have been selected by the admin user to be created.
- $existing_symbols_to_ids : array<string|int, mixed>
- A mapping of post_ids to ticker symbols for currencies that already exist with the "fixer" tag assigned.
- $start_memory : mixed
- $start_time : mixed
- __construct() : mixed
- Constructor hooks this task into the cron job action.
- log() : void
- Cron task logging.
- register() : void
- run() : void
- Do the task.
- create_currencies() : bool
- determine_existing_currencies() : mixed
- do_call() : mixed
- get_cron_interval() : int
- retrieve_currencies_list() : bool
- update_rates() : void
Properties
$name
protected
mixed
$name
string The name of this task.
$priority
protected
mixed
$priority
= 10
int The priority with which to attach to cron action.
$task_start_time
protected
mixed
$task_start_time
= 0
int Timestamp at which this task is starting execution.
$timeout
protected
mixed
$timeout
= DEFAULT_CRON_TASK_TIMEOUT
How many seconds this task is allowed to run. The task's run() method must respect this limit.
$verbose
protected
mixed
$verbose
= false
boolean Whether to write all log() output to debug log.
$api_key
Fixer IO API key, retrieved from DB.
private
string|null
$api_key
= null
$currencies_list
List of fixer currencies as retrieved from /symbols API endpoint, minus the Bitcoin currency.
private
array<string|int, mixed>
$currencies_list
= []
A mapping of ticker symbols to names.
$enabled_symbols
List of fixer symbols that have been selected by the admin user to be created.
private
array<string|int, mixed>
$enabled_symbols
= []
$existing_symbols_to_ids
A mapping of post_ids to ticker symbols for currencies that already exist with the "fixer" tag assigned.
private
array<string|int, mixed>
$existing_symbols_to_ids
= []
$start_memory
private
static mixed
$start_memory
= 0
int Memory used at start of tasks batch execution, measured in bytes.
$start_time
private
static mixed
$start_time
= 0
int Timestamp at which tasks batch starts execution.
Methods
__construct()
Constructor hooks this task into the cron job action.
public
__construct() : mixed
Call this after your sub-class constructor.
This way, any changes you make to $this->priority will have an effect.
WARNING: If you forget to call parent::__construct();
, your task will not run.
Return values
mixed —log()
Cron task logging.
public
final log(string $message[, bool $force = false ]) : void
Migration task is always logged.
Parameters
- $message : string
-
The string to log.
- $force : bool = false
-
Whether to force log the string, even if no verbose logging is checked.
Return values
void —register()
public
final static register() : void
Return values
void —run()
Do the task.
public
run() : void
Concrete implementations must do the work here in chuncks. The max execution time, usually about 15 or 30 secs must be eenough for all the tasks. So be careful!
Return values
void —create_currencies()
private
create_currencies() : bool
Return values
bool —determine_existing_currencies()
private
determine_existing_currencies() : mixed
Return values
mixed —do_call()
private
do_call(string $endpoint) : mixed
Parameters
- $endpoint : string
Return values
mixed —get_cron_interval()
private
static get_cron_interval() : int
Return values
int —retrieve_currencies_list()
private
retrieve_currencies_list() : bool
Return values
bool —update_rates()
private
update_rates() : void