Completed
Push — master ( 06b292...adafac )
by Nicolai
02:22
created

ExpressionLanguageServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
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\Testing\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
        $this->registerAbstracts();
46
    }
47
    
48
    private function registerAbstracts()
49
    {
50
        foreach ($this->provides as $abstract) {
51
            $this->app->singleton($abstract);
52
        }
53
    }
54
    
55
    /**
56
     * Get the services provided by the provider.
57
     *
58
     * @return array
59
     */
60
    public function provides()
61
    {
62
        return $this->provides;
63
    }
64
}
65