1 | <?php |
||
2 | |||
3 | namespace TarfinLabs\Netgsm; |
||
4 | |||
5 | use GuzzleHttp\Client; |
||
6 | use Illuminate\Support\ServiceProvider; |
||
7 | use TarfinLabs\Netgsm\Exceptions\InvalidConfiguration; |
||
8 | |||
9 | class NetgsmServiceProvider extends ServiceProvider |
||
10 | { |
||
11 | /** |
||
12 | * Bootstrap the application services. |
||
13 | */ |
||
14 | public function boot() |
||
15 | { |
||
16 | $this->loadTranslationsFrom(dirname(__DIR__).'/resources/lang', 'netgsm'); |
||
17 | |||
18 | if ($this->app->runningInConsole()) { |
||
19 | $this->publishes([ |
||
20 | dirname(__DIR__).'/resources/lang' => resource_path('lang/vendor/netgsm'), |
||
21 | ]); |
||
22 | |||
23 | $this->publishes([ |
||
24 | __DIR__.'/../config/config.php' => config_path('netgsm.php'), |
||
25 | ], 'config'); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Register the application services. |
||
31 | */ |
||
32 | public function register() |
||
33 | { |
||
34 | // Automatically apply the package configuration |
||
35 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'netgsm'); |
||
36 | |||
37 | $this->app->singleton(Netgsm::class, function ($app) { |
||
0 ignored issues
–
show
|
|||
38 | $config = config('netgsm'); |
||
39 | |||
40 | if (is_null($config)) { |
||
41 | throw InvalidConfiguration::configurationNotSet(); |
||
42 | } |
||
43 | |||
44 | $client = new Client([ |
||
45 | 'base_uri' => $config['defaults']['base_uri'], |
||
46 | 'timeout' => $config['defaults']['timeout'], |
||
47 | ]); |
||
48 | |||
49 | return new Netgsm($client, $config['credentials'], $config['defaults']); |
||
50 | }); |
||
51 | } |
||
52 | } |
||
53 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.