Passed
Push — master ( 935f6a...526326 )
by Gabriel
36:15 queued 01:14
created

FormServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 10
c 1
b 0
f 0
dl 0
loc 49
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A registerFormExtensions() 0 4 1
A provides() 0 3 1
A boot() 0 2 1
A register() 0 4 1
A registerFormRegistry() 0 6 1
1
<?php
2
3
namespace Nip\Form;
4
5
use Nip\Container\ServiceProviders\Providers\AbstractServiceProvider;
6
use Nip\Container\ServiceProviders\Providers\BootableServiceProviderInterface;
7
use Symfony\Component\Form\FormRegistry;
8
9
/**
10
 * Class FilesystemServiceProvider
11
 * @package Nip\Filesystem
12
 *
13
 * @inspiration https://github.com/laravel/framework/blob/5.4/src/Illuminate/Filesystem/FilesystemServiceProvider.php
14
 *
15
 */
16
class FormServiceProvider extends AbstractServiceProvider implements BootableServiceProviderInterface
17
{
18
19
    /**
20
     * @inheritdoc
21
     */
22
    public function provides()
23
    {
24
        return ['form.registry','form.extensions'];
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function register()
31
    {
32
        $this->registerFormRegistry();
33
        $this->registerFormExtensions();
34
    }
35
36
    public function boot()
37
    {
38
//        $this->mergeDefaultFilesystem();
39
    }
40
41
    /**
42
     * Register the native filesystem implementation.
43
     *
44
     * @return void
45
     */
46
    protected function registerFormRegistry()
47
    {
48
        $this->getContainer()->share('form.registry', function () {
49
            return new FormRegistry(
50
                $this->getContainer()->get('form.extensions'),
51
                $this->getContainer()->get('form.extensions')
52
            );
53
        });
54
    }
55
56
    /**
57
     * Register the native filesystem implementation.
58
     *
59
     * @return void
60
     */
61
    protected function registerFormExtensions()
62
    {
63
        $this->getContainer()->share('form.extensions', function () {
64
            return [
65
66
            ];
67
        });
68
}
69
}
70