Completed
Push — master ( 032fc4...769083 )
by Elf
05:36
created

OptimusServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 1
A provides() 0 4 1
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Jenssegers\Optimus\Optimus;
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 1
        $this->app->singleton(Optimus::class, function ($app) {
23
            $config = $app['config']['optimus'];
24
25
            return new Optimus($config['prime'], $config['inverse'], $config['random']);
26 1
        });
27
28 1
        $this->app->alias(Optimus::class, 'optimus');
29 1
    }
30
31
    /**
32
     * Get the services provided by the provider.
33
     *
34
     * @return array
35
     */
36
    public function provides()
37
    {
38
        return [Optimus::class, 'optimus'];
39
    }
40
}
41