Completed
Push — master ( 279d4e...5d09e0 )
by Elf
02:49
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\Providers;
4
5
use Jenssegers\Optimus\Optimus;
6
use Illuminate\Support\ServiceProvider;
7
use ElfSundae\Laravel\Support\Console\Commands\OptimusGenerate;
8
9
class OptimusServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = true;
17
18
    /**
19
     * Register the service provider.
20
     */
21
    public function register()
22
    {
23
        $this->app->singleton(Optimus::class, function ($app) {
24
            $config = $app['config']['optimus'];
25
26
            return new Optimus($config['prime'], $config['inverse'], $config['random']);
27
        });
28
29
        $this->app->alias(Optimus::class, 'optimus');
30
31
        $this->app->singleton('command.optimus.generate', function () {
32
            return new OptimusGenerate;
33
        });
34
35
        $this->commands('command.optimus.generate');
36
    }
37
38
    /**
39
     * Get the services provided by the provider.
40
     *
41
     * @return array
42
     */
43
    public function provides()
44
    {
45
        return [
46
            Optimus::class,
47
            'optimus',
48
            'command.optimus.generate',
49
        ];
50
    }
51
}
52