2018-08-11 23:37:45 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
2018-08-14 01:56:16 -05:00
|
|
|
use LibreNMS\Snmptrap\Handlers\Fallback;
|
2018-08-11 23:37:45 +02:00
|
|
|
|
|
|
|
class SnmptrapProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap the application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2023-05-24 22:21:54 +02:00
|
|
|
public function boot(): void
|
2018-08-11 23:37:45 +02:00
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2023-05-24 22:21:54 +02:00
|
|
|
public function register(): void
|
2018-08-11 23:37:45 +02:00
|
|
|
{
|
2020-06-05 09:29:42 +02:00
|
|
|
$this->app->bind(SnmptrapHandler::class, function ($app, $options) {
|
|
|
|
$oid = reset($options);
|
2020-09-21 14:54:51 +02:00
|
|
|
|
2020-06-05 09:29:42 +02:00
|
|
|
return $app->make(config('snmptraps.trap_handlers')[$oid] ?? Fallback::class);
|
2018-08-11 23:37:45 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|