mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Clean up push driver classes
This commit is contained in:
parent
5a53570dd1
commit
3c15c34aa1
3 changed files with 23 additions and 63 deletions
|
|
@ -10,9 +10,19 @@ class APNs extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
|||
/**
|
||||
* Config keys used by this driver are stored here.
|
||||
*/
|
||||
protected static $_required_config = array();
|
||||
protected static $_required_config = array('certificate', 'passphrase');
|
||||
protected static $_optional_config = array();
|
||||
|
||||
/**
|
||||
* Get the human-readable name of this Push driver.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'iOS (APNs)';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current Push driver is supported on this server.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Framework\Drivers\Push;
|
||||
|
||||
/**
|
||||
* The dummy Push driver.
|
||||
*/
|
||||
class Dummy extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
||||
{
|
||||
/**
|
||||
* Sent messages are stored here for debugging and testing.
|
||||
*/
|
||||
protected $_sent_messages = array();
|
||||
|
||||
/**
|
||||
* Check if the current Push driver is supported on this server.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSupported(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
* @param object $message
|
||||
* @return bool
|
||||
*/
|
||||
public function send(\Rhymix\Framework\Push $message): bool
|
||||
{
|
||||
$this->_sent_messages[] = $message;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sent messages.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSentMessages(): array
|
||||
{
|
||||
return $this->_sent_messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset sent messages.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetSentMessages(): void
|
||||
{
|
||||
$this->_sent_messages = array();
|
||||
}
|
||||
}
|
||||
|
|
@ -10,11 +10,21 @@ class FCM extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
|||
/**
|
||||
* Config keys used by this driver are stored here.
|
||||
*/
|
||||
protected static $_required_config = array();
|
||||
protected static $_required_config = array('api_key');
|
||||
protected static $_optional_config = array();
|
||||
|
||||
/**
|
||||
* Check if the current SMS driver is supported on this server.
|
||||
* Get the human-readable name of this Push driver.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'Android (FCM)';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current Push driver is supported on this server.
|
||||
*
|
||||
* This method returns true on success and false on failure.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue