Completed
Push — master ( 94e14d...b48540 )
by Elf
04:53
created

XgPusherServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 1
b 0
f 0
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