Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
core_sms\gateway Class Reference
Inheritance diagram for core_sms\gateway:
smsgateway_aws\gateway smsgateway_modica\gateway

Public Member Functions

 __construct (public bool readonly bool $enabled, public string string $name, string $config, public null|int readonly ?int $id=null,)
 Create a new gateway.
 
 can_send (message $message)
 Confirm whether this gateway can send the given message.
 
 get_send_priority (message $message)
 Get the priority of this gateway for sending the given message.
 
 send (message $message)
 Send the given message.
 
 to_record ()
 Convert this object to a stdClass.
 
 truncate_message (string $message)
 Truncates the given message to fit the constraints.
 
 update_message_status (message $message)
 Update the status of the given message from the gateway.
 
 update_message_statuses (array $messages)
 Update the statuses of the given messages from the gateway.
 

Public Attributes

stdClass readonly stdClass $config
 The configuration for this instance.
 

Protected Attributes

int const MESSAGE_LENGTH_LIMIT = 160 * 3
 The maximum length of a message.
 

Constructor & Destructor Documentation

◆ __construct()

core_sms\gateway::__construct ( public bool readonly bool $enabled,
public string string $name,
string $config,
public null|int readonly ?int $id = null )

Create a new gateway.

Parameters
bool$enabledWhether the gateway is enabled
string$nameThe name of the gateway config
string$configThe configuration for this instance
int | null$idThe id of the gateway in the database
Parameters
$enabledWhether the gateway is enabled
$nameThe name of the gateway config
$idThe ID of the gateway in the database, or null if it has not been persisted yet

Member Function Documentation

◆ can_send()

core_sms\gateway::can_send ( message $message)

Confirm whether this gateway can send the given message.

Parameters
message$message
Return values
bool

◆ get_send_priority()

core_sms\gateway::get_send_priority ( message $message)
abstract

Get the priority of this gateway for sending the given message.

A priority of 0 means that the gateway cannot send the message. Higher values are higher priority.

This method is called frequently, so should be fast. If calculation is expensive the value should be cached.

Parameters
message$message
Return values
int

Reimplemented in smsgateway_aws\gateway, and smsgateway_modica\gateway.

◆ send()

core_sms\gateway::send ( message $message)
abstract

Send the given message.

Parameters
message$message
Return values
message

Reimplemented in smsgateway_aws\gateway, and smsgateway_modica\gateway.

◆ to_record()

core_sms\gateway::to_record ( )

Convert this object to a stdClass.

Return values
stdClass

◆ truncate_message()

core_sms\gateway::truncate_message ( string $message)

Truncates the given message to fit the constraints.

Parameters
string$messageThe message to be truncated.
Return values
stringThe truncated message.

◆ update_message_status()

core_sms\gateway::update_message_status ( message $message)

Update the status of the given message from the gateway.

Parameters
message$message
Return values
message
Exceptions
coding_exception

◆ update_message_statuses()

core_sms\gateway::update_message_statuses ( array $messages)

Update the statuses of the given messages from the gateway.

Parameters
message[]$messages
Return values
message[]

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