Completed
Push — master ( 1eb12f...b3f467 )
by Elf
04:55
created

OptimusServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 46.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 43
ccs 7
cts 15
cp 0.4667
rs 10
c 1
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 App\Support\Providers;
4
5
use App\Support\Console\Commands\OptimusGenerate;
6
use Illuminate\Support\ServiceProvider;
7
use Jenssegers\Optimus\Optimus;
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 1
    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 1
        });
28
29 1
        $this->app->alias(Optimus::class, 'optimus');
30
31 1
        $this->app->singleton('command.optimus.generate', function () {
32
            return new OptimusGenerate;
33 1
        });
34
35 1
        $this->commands('command.optimus.generate');
36 1
    }
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