PusherServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 38
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 1
A provides() 0 4 1
1
<?php
2
3
namespace ElfSundae\XgPush;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class PusherServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = true;
15
16
    /**
17
     * Register the service provider.
18
     *
19
     * @return void
20
     */
21
    public function register()
22
    {
23
        $this->app->singleton('xgpusher', function ($app) {
24
            $config = $app['config']->get('services.xgpush');
25
26
            return (new Pusher($config['key'], $config['secret']))
27
                ->setEnvironment($config['environment'])
28
                ->setCustomKey($config['custom_key'])
29
                ->setAccountPrefix($config['account_prefix']);
30
        });
31
32
        $this->app->alias('xgpusher', Pusher::class);
33
    }
34
35
    /**
36
     * Get the services provided by the provider.
37
     *
38
     * @return string[]
39
     */
40
    public function provides()
41
    {
42
        return ['xgpusher', Pusher::class];
43
    }
44
}
45