ExpressionLanguageServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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