PremailerServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
A boot() 0 9 1
1
<?php namespace Luminaire\Premailer\Laravel;
2
3
/**
4
 * Created by Sublime Text 3
5
 *
6
 * @user     Kevin Tanjung
7
 * @website  http://kevintanjung.github.io
8
 * @email    [email protected]
9
 * @date     04/08/2016
10
 * @time     11:15
11
 */
12
13
use Illuminate\Support\ServiceProvider;
14
use Illuminate\View\Engines\EngineResolver;
15
use Illuminate\View\Engines\CompilerEngine;
16
use Luminaire\Premailer\Laravel\PremailerEngine;
17
18
/**
19
 * The "Premailer" service provider
20
 *
21
 * @package  \Luminaire\Premailer\Laravel
22
 */
23
class PremailerServiceProvider extends ServiceProvider
24
{
25
26
    /**
27
     * Register the service provider.
28
     *
29
     * @return void
30
     */
31
    public function register()
32
    {
33
        $this->app->singleton('premailer.compiler', function ($app)
34
        {
35
            return new PremailerCompiler($app['files'], storage_path('premailer'));
36
        });
37
38
        $this->app->singleton('premailer.engine', function ($app)
39
        {
40
            $blade = new CompilerEngine($app['blade.compiler']);
41
42
            return new PremailerEngine($blade, $app['premailer.compiler']);
43
        });
44
    }
45
46
    /**
47
     * Boot the service provider.
48
     *
49
     * @return void
50
     */
51
    public function boot()
52
    {
53
        $view = $this->app['view'];
54
55
        $view->addExtension('premailer', 'premailer', function ()
56
        {
57
            return $this->app['premailer.engine'];
58
        });
59
    }
60
61
}
62