LineServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 12
cp 0
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\Line;
4
5
use LINE\LINEBot;
6
use Illuminate\Support\ServiceProvider;
7
use LINE\LINEBot\HTTPClient\CurlHTTPClient;
8
9
class LineServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        // Bootstrap code here.
17
18
        $this->app->when(LineChannel::class)
19
            ->needs(LINEBot::class)
20
            ->give(function () {
21
                $httpClient = new CurlHTTPClient(config('services.line.token'));
22
23
                return new LINEBot(
24
                    $httpClient,
25
                    ['channelSecret' => config('services.line.secret')]
26
                );
27
            });
28
    }
29
30
    /**
31
     * Register the application services.
32
     */
33
    public function register()
34
    {
35
    }
36
}
37