These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace RenePardon\GelfSupport; |
||
4 | |||
5 | use Gelf\Publisher; |
||
6 | use Gelf\Transport\UdpTransport; |
||
7 | use Illuminate\Config\Repository; |
||
8 | use Illuminate\Contracts\Debug\ExceptionHandler; |
||
9 | use Illuminate\Support\ServiceProvider; |
||
10 | |||
11 | /** |
||
12 | * Class GelfSupportServiceProvider |
||
13 | * |
||
14 | * @package renepardon\GelfSupport |
||
15 | */ |
||
16 | class GelfSupportServiceProvider extends ServiceProvider |
||
17 | { |
||
18 | /** |
||
19 | * Perform post-registration booting of services. |
||
20 | * |
||
21 | * @return void |
||
22 | */ |
||
23 | public function boot() |
||
24 | { |
||
25 | $this->publishes([ |
||
26 | __DIR__ . '/../config/gelfsupport.php' => config_path('gelfsupport.php'), |
||
27 | ], 'config'); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Register any package services. |
||
32 | * |
||
33 | * @return void |
||
34 | */ |
||
35 | public function register() |
||
36 | { |
||
37 | $config = $this->app->make(Repository::class); |
||
38 | |||
39 | $this->app->alias(ExceptionHandler::class, 'exceptions'); |
||
40 | $this->app->singleton('exceptions.repository', ExceptionHandlerRepository::class); |
||
41 | $this->app->extend(ExceptionHandler::class, function ($handler, $app) use ($config) { |
||
42 | return new Decorator($handler, $app['exceptions.repository'], $config); |
||
43 | }); |
||
44 | |||
45 | $this->app->singleton(Graylog::class, function ($app) use ($config) { |
||
0 ignored issues
–
show
|
|||
46 | $transport = new UdpTransport( |
||
47 | $config->get('gelfsupport.host'), |
||
48 | $config->get('gelfsupport.port'), |
||
49 | UdpTransport::CHUNK_SIZE_LAN |
||
50 | ); |
||
51 | |||
52 | // While the UDP transport is itself a publisher, we wrap it in a real Publisher for convenience. |
||
53 | // A publisher allows for message validation before transmission, and also supports sending |
||
54 | // messages to multiple backends at once. |
||
55 | $publisher = new Publisher(); |
||
56 | $publisher->addTransport($transport); |
||
57 | |||
58 | return new Graylog($publisher, 'gelf-php'); |
||
59 | }); |
||
60 | } |
||
61 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.