Completed
Push — master ( b3f467...3d5acc )
by Elf
05:46
created

XgPusherServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 39
ccs 4
cts 4
cp 1
rs 10
c 1
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 App\Support\Providers;
4
5
use App\Support\Tencent\XgPusher;
6
use Illuminate\Support\ServiceProvider;
7
8
class XgPusherServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = true;
16
17
    /**
18
     * Register the service provider.
19
     */
20
    public function register()
21
    {
22 1
        $this->app->singleton(XgPusher::class, function ($app) {
23
            $config = $app['config']['services.xgpush'];
24
25
            return (new XgPusher($config['key'], $config['secret']))
26
                ->setEnvironment($config['environment'])
27
                ->setCustomKey($config['custom'])
28
                ->setAccountPrefix($config['account_prefix']);
29 1
        });
30
31 1
        $this->app->alias(XgPusher::class, 'xgpusher');
32 1
    }
33
34
    /**
35
     * Get the services provided by the provider.
36
     *
37
     * @return array
38
     */
39
    public function provides()
40
    {
41
        return [
42
            XgPusher::class,
43
            'xgpusher',
44
        ];
45
    }
46
}
47