DirectiveServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 17 1
1
<?php
2
3
namespace Jhoff\BladeVue;
4
5
use Jhoff\BladeVue\Directives\Basic;
6
use Jhoff\BladeVue\Directives\Inline;
7
use Illuminate\Support\ServiceProvider;
8
use Illuminate\View\Compilers\BladeCompiler;
9
10
class DirectiveServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Indicates if loading of the provider is deferred.
14
     *
15
     * @var bool
16
     */
17
    protected $defer = false;
18
19
    /**
20
     * Register the service provider.
21
     *
22
     * @return void
23
     */
24 20
    public function register()
25
    {
26
        $this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
27
            $bladeCompiler->directive('vue', function ($expression) {
28 2
                return Basic::start($expression);
29 4
            });
30
31
            $bladeCompiler->directive('endvue', function () {
32 2
                return Basic::end();
33 4
            });
34
35
            $bladeCompiler->directive('inlinevue', function ($expression) {
36 2
                return Inline::start($expression);
37 4
            });
38
39
            $bladeCompiler->directive('endinlinevue', function () {
40 2
                return Inline::end();
41 4
            });
42 20
        });
43 20
    }
44
}
45