Completed
Push — master ( f0d1a4...bf72bf )
by Elf
09:50
created

XgPusherServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 1
A provides() 0 7 1
1
<?php
2
3
namespace ElfSundae\Laravel\Support\Services\XgPush;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class XgPusherServiceProvider 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
    public function register()
20
    {
21
        $this->app->singleton(XgPusher::class, function ($app) {
22
            $config = $app['config']['support.xgpush'];
23
24
            return (new XgPusher($config['key'], $config['secret']))
25
                ->setEnvironment($config['environment'])
26
                ->setCustomKey($config['custom_key'])
27
                ->setAccountPrefix($config['account_prefix']);
28
        });
29
30
        $this->app->alias(XgPusher::class, 'xgpusher');
31
    }
32
33
    /**
34
     * Get the services provided by the provider.
35
     *
36
     * @return array
37
     */
38
    public function provides()
39
    {
40
        return [
41
            XgPusher::class,
42
            'xgpusher',
43
        ];
44
    }
45
}
46