mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Clean up code.
This commit is contained in:
@@ -31,27 +31,6 @@ use NotificationChannels\Pushover\PushoverReceiver;
|
||||
|
||||
class OwnerNotifiable
|
||||
{
|
||||
public function routeNotificationForSlack(): string
|
||||
{
|
||||
$res = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;
|
||||
if (is_array($res)) {
|
||||
$res = '';
|
||||
}
|
||||
|
||||
return (string) $res;
|
||||
}
|
||||
|
||||
public function routeNotificationForPushover()
|
||||
{
|
||||
Log::debug('Return settings for routeNotificationForPushover');
|
||||
$pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data;
|
||||
$pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;
|
||||
|
||||
return PushoverReceiver::withUserKey($pushoverUserToken)
|
||||
->withApplicationToken($pushoverAppToken)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification routing information for the given driver.
|
||||
*
|
||||
@@ -62,7 +41,7 @@ class OwnerNotifiable
|
||||
*/
|
||||
public function routeNotificationFor($driver, $notification = null)
|
||||
{
|
||||
$method = 'routeNotificationFor'.Str::studly($driver);
|
||||
$method = 'routeNotificationFor' . Str::studly($driver);
|
||||
if (method_exists($this, $method)) {
|
||||
Log::debug(sprintf('Redirect for settings to "%s".', $method));
|
||||
|
||||
@@ -75,4 +54,24 @@ class OwnerNotifiable
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
|
||||
public function routeNotificationForPushover()
|
||||
{
|
||||
Log::debug('Return settings for routeNotificationForPushover');
|
||||
$pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data;
|
||||
$pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;
|
||||
|
||||
return PushoverReceiver::withUserKey($pushoverUserToken)
|
||||
->withApplicationToken($pushoverAppToken);
|
||||
}
|
||||
|
||||
public function routeNotificationForSlack(): string
|
||||
{
|
||||
$res = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;
|
||||
if (is_array($res)) {
|
||||
$res = '';
|
||||
}
|
||||
|
||||
return (string) $res;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user