GcmServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 11
cp 0
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\Gcm;
4
5
use Zend\Http\Client\Adapter\Curl;
6
use ZendService\Google\Gcm\Client;
7
use Illuminate\Support\ServiceProvider;
8
9
class GcmServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function register()
15
    {
16
        $this->app->when(GcmChannel::class)
17
            ->needs(Client::class)
18
            ->give(function () {
19
                $gcmConfig = config('broadcasting.connections.gcm');
20
21
                $client = new Client();
22
                $client->setApiKey($gcmConfig['key']);
23
                $client->getHttpClient()->setAdapter(new Curl());
24
25
                return $client;
26
            });
27
    }
28
}
29