1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-02-24 15:02:28 +01:00

Add sound support

Add support for the default API sounds
This commit is contained in:
Rvanlaak 2014-04-09 11:48:02 +02:00
parent 607f20d4f9
commit 3df597f1c5

View File

@ -31,6 +31,17 @@ class PushoverHandler extends SocketHandler
private $highPriorityLevel;
private $emergencyLevel;
/**
* Sounds the api supports by default
* @see https://pushover.net/api#sounds
* @var array
*/
private $sounds = array(
'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming',
'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb',
'persistent', 'echo', 'updown', 'none',
);
/**
* @param string $token Pushover api token
* @param string|array $users Pushover user id or array of ids the message will be sent to
@ -90,6 +101,10 @@ class PushoverHandler extends SocketHandler
$dataArray['priority'] = 1;
}
if (isset($record['sound']) && in_array($record['sound'], $this->sounds)) {
$dataArray['sound'] = $record['sound'];
}
return http_build_query($dataArray);
}