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

OptimusServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 8
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace ElfSundae\Laravel\Support\Services\Optimus;
4
5
use Jenssegers\Optimus\Optimus;
6
use Illuminate\Support\ServiceProvider;
7
8
class OptimusServiceProvider 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
        $this->app->singleton(Optimus::class, function ($app) {
23
            $config = $app['config']->get('support.optimus');
24
25
            return new Optimus($config['prime'], $config['inverse'], $config['random']);
26
        });
27
28
        $this->app->alias(Optimus::class, 'optimus');
29
30
        $this->app->singleton('command.optimus.generate', function () {
31
            return new GenerateOptimusCommand;
32
        });
33
34
        $this->commands('command.optimus.generate');
35
    }
36
37
    /**
38
     * Get the services provided by the provider.
39
     *
40
     * @return array
41
     */
42
    public function provides()
43
    {
44
        return [
45
            Optimus::class,
46
            'optimus',
47
            'command.optimus.generate',
48
        ];
49
    }
50
}
51