mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-18 15:41:26 +02:00
[ticket/17135] Add messenger method interface class
PHPBB-17135
This commit is contained in:
@@ -29,7 +29,7 @@ use phpbb\user;
|
||||
/**
|
||||
* Messenger base class
|
||||
*/
|
||||
abstract class base
|
||||
abstract class base implements messenger_interface
|
||||
{
|
||||
/** @var array */
|
||||
protected $additional_headers = [];
|
||||
@@ -142,16 +142,12 @@ abstract class base
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messenger method id
|
||||
*
|
||||
* @return int
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
abstract public function get_id(): int;
|
||||
|
||||
/**
|
||||
* Check if the messenger method is enabled
|
||||
*
|
||||
* @return bool
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
abstract public function is_enabled(): bool;
|
||||
|
||||
@@ -176,6 +172,7 @@ abstract class base
|
||||
* Set addresses for to/im as available
|
||||
*
|
||||
* @param array $user_row User row
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function set_addresses(array $user_row): void;
|
||||
@@ -188,10 +185,7 @@ abstract class base
|
||||
abstract public function get_queue_object_name(): string;
|
||||
|
||||
/**
|
||||
* Set up subject for mail
|
||||
*
|
||||
* @param string $subject Email subject
|
||||
* @return void
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function subject(string $subject = ''): void
|
||||
{
|
||||
@@ -199,16 +193,15 @@ abstract class base
|
||||
}
|
||||
|
||||
/**
|
||||
* Send out messages
|
||||
*
|
||||
* @return bool
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
abstract protected function send(): bool;
|
||||
abstract public function send(): bool;
|
||||
|
||||
/**
|
||||
* Send messages from the queue
|
||||
*
|
||||
* @param array $queue_data Queue data array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function process_queue(array &$queue_data): void;
|
||||
@@ -303,6 +296,7 @@ abstract class base
|
||||
* Assign variables to email template
|
||||
*
|
||||
* @param array $vars Array of VAR => VALUE to assign to email template
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assign_vars(array $vars): void
|
||||
@@ -316,6 +310,7 @@ abstract class base
|
||||
*
|
||||
* @param string $blockname Template block name
|
||||
* @param array $vars Array of VAR => VALUE to assign to email template block
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assign_block_vars(string $blockname, array $vars): void
|
||||
@@ -402,10 +397,7 @@ abstract class base
|
||||
}
|
||||
|
||||
/**
|
||||
* Add error message to log
|
||||
*
|
||||
* @param string $msg Error message text
|
||||
* @return void
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function error(string $msg): void
|
||||
{
|
||||
@@ -426,6 +418,7 @@ abstract class base
|
||||
|
||||
/**
|
||||
* Save message data to the messenger file queue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save_queue(): void
|
||||
@@ -479,6 +472,7 @@ abstract class base
|
||||
*
|
||||
* @param string|array $path_name Email template path name
|
||||
* @param string|array $paths Email template paths
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_template_paths(string|array $path_name, string|array $paths): void
|
||||
|
59
phpBB/phpbb/messenger/method/messenger_interface.php
Normal file
59
phpBB/phpbb/messenger/method/messenger_interface.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\messenger\method;
|
||||
|
||||
/**
|
||||
* Messenger method interface class
|
||||
*/
|
||||
interface messenger_interface
|
||||
{
|
||||
/**
|
||||
* Get messenger method id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_id(): int;
|
||||
|
||||
/**
|
||||
* Check if the messenger method is enabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_enabled(): bool;
|
||||
|
||||
/**
|
||||
* Set up subject for the message
|
||||
*
|
||||
* @param string $subject Email subject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function subject(string $subject = ''): void;
|
||||
|
||||
/**
|
||||
* Send out messages
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function send(): bool;
|
||||
|
||||
/**
|
||||
* Add error message to log
|
||||
*
|
||||
* @param string $msg Error message text
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error(string $msg): void;
|
||||
}
|
Reference in New Issue
Block a user