Completed
Push — master ( 7c85b2...91e0f6 )
by Aly
05:47
created

ExpoPushNotificationsServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
ccs 0
cts 9
cp 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\ExpoPushNotifications;
4
5
use ExponentPhpSDK\Expo;
6
use ExponentPhpSDK\ExpoRegistrar;
7
use ExponentPhpSDK\ExpoRepository;
8
use ExponentPhpSDK\Repositories\ExpoFileDriver;
9
use Illuminate\Support\ServiceProvider;
10
11
class ExpoPushNotificationsServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application services.
15
     */
16
    public function boot()
17
    {
18
        $this->app->when(ExpoChannel::class)
19
            ->needs(Expo::class)
20
            ->give(function () {
21
                return new Expo(new ExpoRegistrar(new ExpoFileDriver()));
22
            });
23
24
        //Load routes
25
        $this->loadRoutesFrom(__DIR__ . '/Http/routes.php');
26
    }
27
28
    /**
29
     * Register the application services.
30
     */
31
    public function register()
32
    {
33
        $this->app->bind(ExpoRepository::class, ExpoFileDriver::class);
34
    }
35
}
36