Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
tool_brickfield\mock_registration Class Reference

Mock registration. More...

Inheritance diagram for tool_brickfield\mock_registration:
tool_brickfield\registration

Public Member Functions

 get_api_key ()
 Get api key.
 
 get_regurl ()
 Get the registration URL.
 
 get_secret_key ()
 Get secret key.
 
 get_siteid ()
 Return the registered site id.
 
 get_termsurl ()
 Get the terms and conditions URL.
 
 invalidate_summary_time ()
 Invalidate summary time.
 
 invalidate_validation_time ()
 Invalidate validation time.
 
 is_not_entered ()
 Is not entered.
 
 mark_summary_data_sent ()
 Perform all actions needed to note that the summary data was sent.
 
 revalidate ()
 Even if the regisration is currently valid, validate it again.
 
 set_keys_for_registration (string $apikey, string $secretkey)
 Perform all necessary steps when new keys are added.
 
 set_siteid (int $id)
 Set the registered site id.
 
 toolkit_is_active ()
 System can be used when it has been validated, or when its still awaiting validation.
 
 validate ()
 If the registration is not already valid, validate it.
 
 validation_error ()
 Return true if there was a validation error.
 
 validation_pending ()
 The "not validated" state also needs the grace period to still be in effect.
 

Public Attributes

string const API_KEY = 'key'
 Name of variable storing the registration API key.
 
int const ERROR = 5
 Registration validation attempted, but failed.
 
int const EXPIRED = 4
 Registration information has expired and needs to be revalidated.
 
int const INVALID = 2
 Registration information was entered but was not validated within the defined grace periods.
 
int const NOT_ENTERED = 0
 Registration information has not been entered.
 
int const PENDING = 1
 Registration information has been entered but not externally validated.
 
string const SECRET_KEY = 'hash'
 Name of variable storing the registration API key.
 
string const SITEID = 'id'
 Name of the variable storing the site id.
 
string const STATUS = 'bfregstatus'
 Name of variable storing the registration status.
 
string const SUMMARY_TIME = 'bfsummarytime'
 Name of variable storing the time the summary data was last sent.
 
int const VALIDATED = 3
 Registration information has been externally validated.
 
string const VALIDATION_CHECK_TIME = 'bfregvalidationchecktime'
 Name of variable storing the last time the registration information was checked.
 
string const VALIDATION_TIME = 'bfregvalidationtime'
 Name of variable storing the time the registration information was validated.
 

Protected Member Functions

 apikey_is_valid (string $apikey)
 Validates that the entered API key is in the expected format.
 
 get_check_time ()
 Get the time of the last registration check.
 
 get_grace_period ()
 Get the registration grace period.
 
 get_registration_connection ()
 Get registration connection.
 
 get_status ()
 Return the current registration status.
 
 get_summary_time ()
 Return the time of the last summary update.
 
 get_validation_time ()
 Return the time of the registration validation.
 
 grace_period_valid ()
 Check if the unvalidated time is still within the grace period.
 
 keys_are_valid (?string $apikey=null, ?string $secretkey=null)
 Return true if all keys have valid format.
 
 secretkey_is_valid (string $secretkey)
 Validates that the entered Secret key is in the expected format.
 
 set_api_key (string $keyvalue)
 Set the configured api key value.
 
 set_check_time (int $time=0)
 Set the time of the last registration check.
 
 set_error ()
 Set the status to "error".
 
 set_expired ()
 Set the status to "expired".
 
 set_invalid ()
 Set the registration as invalid.
 
 set_not_entered ()
 Set the status as keys "not entered".
 
 set_not_validated ()
 "Not validated" means we have keys, but have not confirmed them yet.
 
 set_secret_key (string $keyvalue)
 Set the configured secret key value.
 
 set_status (int $status)
 Set the current registration status.
 
 set_summary_time (int $time=0)
 Set the time of the summary update.
 
 set_valid ()
 Set the registration as valid.
 
 set_validation_time (int $time=0)
 Set the registration validation time.
 
 status_is_error ()
 Return true if the current status is "error".
 
 status_is_expired ()
 Return true if the current status is "expired".
 
 status_is_invalid ()
 Return true if the current status is "invalid".
 
 status_is_not_entered ()
 Return true if the current status is "not entered".
 
 status_is_pending ()
 Return true if the current status is "pending".
 
 status_is_validated ()
 Return true if the logic says that the registration is valid.
 
 summarydata_grace_period_expired ()
 Check if the last time the summary data was sent is within the grace period.
 
 valid_key_format (string $key)
 Validates that the passed in key looks like an MD5 hash.
 

Protected Attributes

string $apikey
 The API key required for registration.
 
int $checktime
 The last time the validation was checked.
 
string $secretkey
 The secret key required for registration.
 
string $siteid
 The registered site id.
 
int $summarytime
 The last time the summary data was sent.
 
int $validation
 The current validation status.
 
int $validationtime
 The last time the validation time was confirmed.
 

Detailed Description

Mock registration.

Member Function Documentation

◆ apikey_is_valid()

tool_brickfield\registration::apikey_is_valid ( string $apikey)
protectedinherited

Validates that the entered API key is in the expected format.

Parameters
string$apikey
Return values
bool

◆ get_api_key()

tool_brickfield\registration::get_api_key ( )
inherited

Get api key.

Return values
string
Exceptions
dml_exception

◆ get_check_time()

tool_brickfield\registration::get_check_time ( )
protectedinherited

Get the time of the last registration check.

Return values
int
Exceptions
dml_exception

◆ get_grace_period()

tool_brickfield\registration::get_grace_period ( )
protectedinherited

Get the registration grace period.

Return values
int

◆ get_registration_connection()

tool_brickfield\mock_registration::get_registration_connection ( )
protected

Get registration connection.

Return values
brickfieldconnect

Reimplemented from tool_brickfield\registration.

◆ get_regurl()

tool_brickfield\registration::get_regurl ( )
inherited

Get the registration URL.

Return values
string

◆ get_secret_key()

tool_brickfield\registration::get_secret_key ( )
inherited

Get secret key.

Return values
string
Exceptions
dml_exception

◆ get_siteid()

tool_brickfield\registration::get_siteid ( )
inherited

Return the registered site id.

Return values
int
Exceptions
dml_exception

◆ get_status()

tool_brickfield\registration::get_status ( )
protectedinherited

Return the current registration status.

Return values
int
Exceptions
dml_exception

◆ get_summary_time()

tool_brickfield\registration::get_summary_time ( )
protectedinherited

Return the time of the last summary update.

Return values
int
Exceptions
dml_exception

◆ get_termsurl()

tool_brickfield\registration::get_termsurl ( )
inherited

Get the terms and conditions URL.

Return values
string

◆ get_validation_time()

tool_brickfield\registration::get_validation_time ( )
protectedinherited

Return the time of the registration validation.

Return values
int
Exceptions
dml_exception

◆ grace_period_valid()

tool_brickfield\registration::grace_period_valid ( )
protectedinherited

Check if the unvalidated time is still within the grace period.

Return values
bool

◆ invalidate_summary_time()

tool_brickfield\mock_registration::invalidate_summary_time ( )

Invalidate summary time.

Return values
int
Exceptions
dml_exception

◆ invalidate_validation_time()

tool_brickfield\mock_registration::invalidate_validation_time ( )

Invalidate validation time.

Return values
int
Exceptions
dml_exception

◆ is_not_entered()

tool_brickfield\mock_registration::is_not_entered ( )

Is not entered.

Return values
bool

◆ keys_are_valid()

tool_brickfield\registration::keys_are_valid ( ?string $apikey = null,
?string $secretkey = null )
protectedinherited

Return true if all keys have valid format.

Parameters
string | null$apikey
string | null$secretkey
Return values
bool

◆ revalidate()

tool_brickfield\registration::revalidate ( )
inherited

Even if the regisration is currently valid, validate it again.

Return values
bool
Exceptions
dml_exception

◆ secretkey_is_valid()

tool_brickfield\registration::secretkey_is_valid ( string $secretkey)
protectedinherited

Validates that the entered Secret key is in the expected format.

Parameters
string$secretkey
Return values
bool

◆ set_api_key()

tool_brickfield\registration::set_api_key ( string $keyvalue)
protectedinherited

Set the configured api key value.

Parameters
string$keyvalue
Return values
bool

◆ set_check_time()

tool_brickfield\registration::set_check_time ( int $time = 0)
protectedinherited

Set the time of the last registration check.

Parameters
int$time
Return values
bool

◆ set_error()

tool_brickfield\registration::set_error ( )
protectedinherited

Set the status to "error".

Return values
bool

◆ set_expired()

tool_brickfield\registration::set_expired ( )
protectedinherited

Set the status to "expired".

Return values
bool

◆ set_invalid()

tool_brickfield\registration::set_invalid ( )
protectedinherited

Set the registration as invalid.

Return values
bool

◆ set_keys_for_registration()

tool_brickfield\registration::set_keys_for_registration ( string $apikey,
string $secretkey )
inherited

Perform all necessary steps when new keys are added.

Also check that they actually look like keys.

Parameters
string$apikey
string$secretkey
Return values
bool

◆ set_not_entered()

tool_brickfield\registration::set_not_entered ( )
protectedinherited

Set the status as keys "not entered".

Return values
bool

◆ set_not_validated()

tool_brickfield\registration::set_not_validated ( )
protectedinherited

"Not validated" means we have keys, but have not confirmed them yet.

Set the validation time to start the grace period.

Return values
bool

◆ set_secret_key()

tool_brickfield\registration::set_secret_key ( string $keyvalue)
protectedinherited

Set the configured secret key value.

Parameters
string$keyvalue
Return values
bool

◆ set_siteid()

tool_brickfield\registration::set_siteid ( int $id)
inherited

Set the registered site id.

Parameters
int$id
Return values
bool

◆ set_status()

tool_brickfield\registration::set_status ( int $status)
protectedinherited

Set the current registration status.

Parameters
int$status
Return values
bool

◆ set_summary_time()

tool_brickfield\registration::set_summary_time ( int $time = 0)
protectedinherited

Set the time of the summary update.

Parameters
int$time
Return values
bool

◆ set_valid()

tool_brickfield\registration::set_valid ( )
protectedinherited

Set the registration as valid.

Return values
bool

◆ set_validation_time()

tool_brickfield\registration::set_validation_time ( int $time = 0)
protectedinherited

Set the registration validation time.

Parameters
int$time
Return values
bool

◆ status_is_error()

tool_brickfield\registration::status_is_error ( )
protectedinherited

Return true if the current status is "error".

Return values
bool

◆ status_is_expired()

tool_brickfield\registration::status_is_expired ( )
protectedinherited

Return true if the current status is "expired".

Return values
bool

◆ status_is_invalid()

tool_brickfield\registration::status_is_invalid ( )
protectedinherited

Return true if the current status is "invalid".

Return values
bool

◆ status_is_not_entered()

tool_brickfield\registration::status_is_not_entered ( )
protectedinherited

Return true if the current status is "not entered".

Return values
bool

◆ status_is_pending()

tool_brickfield\registration::status_is_pending ( )
protectedinherited

Return true if the current status is "pending".

Return values
bool

◆ status_is_validated()

tool_brickfield\registration::status_is_validated ( )
protectedinherited

Return true if the logic says that the registration is valid.

Return values
bool

◆ summarydata_grace_period_expired()

tool_brickfield\registration::summarydata_grace_period_expired ( )
protectedinherited

Check if the last time the summary data was sent is within the grace period.

Return values
bool

◆ toolkit_is_active()

tool_brickfield\registration::toolkit_is_active ( )
inherited

System can be used when it has been validated, or when its still awaiting validation.

Return values
bool

◆ valid_key_format()

tool_brickfield\registration::valid_key_format ( string $key)
protectedinherited

Validates that the passed in key looks like an MD5 hash.

Parameters
string$key
Return values
bool

◆ validate()

tool_brickfield\registration::validate ( )
inherited

If the registration is not already valid, validate it.

This may connect to the registration site.

Return values
bool
Exceptions
dml_exception

◆ validation_error()

tool_brickfield\registration::validation_error ( )
inherited

Return true if there was a validation error.

Return values
bool

◆ validation_pending()

tool_brickfield\registration::validation_pending ( )
inherited

The "not validated" state also needs the grace period to still be in effect.

Return values
bool

The documentation for this class was generated from the following file: