ExpressionLanguageServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 2
A registerAbstracts() 0 6 2
A provides() 0 4 1
1
<?php
2
3
4
namespace SmartWeb\ModuleTesting\Providers;
5
6
use Illuminate\Support\ServiceProvider;
7
use SmartWeb\ModuleTesting\ExpressionLanguage\Functions\Call;
8
use SmartWeb\ModuleTesting\ExpressionLanguage\Functions\String\Lowercase;
9
use SmartWeb\ModuleTesting\ExpressionLanguage\Providers\PhpExpressionLanguageProvider;
10
use SmartWeb\ModuleTesting\ExpressionLanguage\Providers\StringExpressionLanguageProvider;
11
12
13
/**
14
 * Provides ExpressionLanguages and ExpressionFunctions
15
 *
16
 * @package SmartWeb\ModuleTesting\Providers
17
 */
18
class ExpressionLanguageServiceProvider extends ServiceProvider
19
{
20
    
21
    /**
22
     * Indicates if loading of the provider is deferred.
23
     *
24
     * @var bool
25
     */
26
    protected $defer = true;
27
    
28
    /**
29
     * @var string[]
30
     */
31
    private $provides = [
32
        StringExpressionLanguageProvider::class,
33
        PhpExpressionLanguageProvider::class,
34
        Lowercase::class,
35
        Call::class,
36
    ];
37
    
38
    /**
39
     * Register the service provider.
40
     *
41
     * @return void
42
     */
43
    public function register()
44
    {
45
        if ($this->app->environment() !== 'production') {
46
            $this->registerAbstracts();
47
        }
48
    }
49
    
50
    private function registerAbstracts()
51
    {
52
        foreach ($this->provides as $abstract) {
53
            $this->app->singleton($abstract);
54
        }
55
    }
56
    
57
    /**
58
     * Get the services provided by the provider.
59
     *
60
     * @return array
61
     */
62
    public function provides()
63
    {
64
        return $this->provides;
65
    }
66
}
67