Completed
Push — master ( 7079af...e44d2f )
by Colin
10s
created

LumenServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 4
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
A withFacades() 0 3 1
1
<?php
2
3
namespace Cviebrock\LaravelElasticsearch;
4
5
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
6
7
8
/**
9
 * Class ServiceProvider
10
 *
11
 * @package Cviebrock\LaravelElasticsearch
12
 */
13
class LumenServiceProvider extends BaseServiceProvider
14
{
15
16
    /**
17
     * Indicates if loading of the provider is deferred.
18
     *
19
     * @var bool
20
     */
21
    protected $defer = false;
22
23
    /**
24
     * Register the service provider.
25
     *
26
     * @return void
27
     */
28
    public function register()
29
    {
30
        $app = $this->app;
31
32
        $app->singleton('elasticsearch.factory', function($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
            return new Factory();
34
        });
35
36
        $app->singleton('elasticsearch', function($app) {
37
            return new LumenManager($app, $app['elasticsearch.factory']);
38
        });
39
40
        $this->withFacades();
41
    }
42
43
	protected function withFacades() {
44
		class_alias('\Cviebrock\LaravelElasticsearch\Facade', 'Elasticsearch');
45
	}
46
}
47