1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Skater4\LaravelSentryNotifications\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Skater4\LaravelSentryNotifications\Notifications\Factories\NotificationEntityFactory; |
7
|
|
|
use Skater4\LaravelSentryNotifications\Notifications\Factories\NotificationFactory; |
8
|
|
|
use Skater4\LaravelSentryNotifications\Services\Messengers\Factories\MessageFormatterFactory; |
9
|
|
|
use Skater4\LaravelSentryNotifications\Services\Messengers\Factories\MessengerClientFactory; |
10
|
|
|
use Skater4\LaravelSentryNotifications\Services\Sentry\Interfaces\SentryServiceInterface; |
11
|
|
|
use Skater4\LaravelSentryNotifications\Services\SentryNotifier; |
12
|
|
|
|
13
|
|
|
class NotifierServiceProvider extends ServiceProvider |
14
|
|
|
{ |
15
|
|
|
public function register(): void |
16
|
|
|
{ |
17
|
|
|
$this->mergeConfigFrom( |
18
|
|
|
__DIR__ . '/../../config/services.php', 'services' |
19
|
|
|
); |
20
|
|
|
|
21
|
|
|
$this->app->singleton(SentryNotifier::class, function ($app) { |
|
|
|
|
22
|
|
|
return new SentryNotifier( |
23
|
|
|
app(SentryServiceInterface::class), |
24
|
|
|
); |
25
|
|
|
}); |
26
|
|
|
|
27
|
|
|
$this->app->singleton(MessageFormatterFactory::class, function ($app) { |
28
|
|
|
return new MessageFormatterFactory( |
29
|
|
|
$app['config']['services']['laravel-sentry-notifications']['service'] |
30
|
|
|
); |
31
|
|
|
}); |
32
|
|
|
|
33
|
|
|
$this->app->singleton(MessengerClientFactory::class, function ($app) { |
34
|
|
|
return new MessengerClientFactory( |
35
|
|
|
$app['config']['services']['laravel-sentry-notifications']['service'] |
36
|
|
|
); |
37
|
|
|
}); |
38
|
|
|
|
39
|
|
|
$this->app->singleton(NotificationEntityFactory::class, function ($app) { |
40
|
|
|
return new NotificationEntityFactory( |
41
|
|
|
$app['config']['services']['laravel-sentry-notifications']['service'] |
42
|
|
|
); |
43
|
|
|
}); |
44
|
|
|
|
45
|
|
|
$this->app->singleton(NotificationFactory::class, function ($app) { |
46
|
|
|
return new NotificationFactory( |
47
|
|
|
$app['config']['services']['laravel-sentry-notifications']['service'] |
48
|
|
|
); |
49
|
|
|
}); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.