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

FormServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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