Completed
Push — master ( f0d1a4...bf72bf )
by Elf
09:50
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 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 7
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
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