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

OptimusServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 43
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
A provides() 0 8 1
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