FilesystemSymfonyServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jellyfish\FilesystemSymfony;
6
7
use Pimple\Container;
8
use Pimple\ServiceProviderInterface;
9
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
10
11
class FilesystemSymfonyServiceProvider implements ServiceProviderInterface
12
{
13
    /**
14
     * @param \Pimple\Container $pimple
15
     *
16
     * @return void
17
     */
18
    public function register(Container $pimple): void
19
    {
20
        $this->registerFilesystem($pimple);
21
    }
22
23
    /**
24
     * @param \Pimple\Container $container
25
     *
26
     * @return \Jellyfish\FilesystemSymfony\FilesystemSymfonyServiceProvider
27
     */
28
    protected function registerFilesystem(Container $container): FilesystemSymfonyServiceProvider
29
    {
30
        $container->offsetSet('filesystem', function () {
31
            $symfonyFilesystem = new SymfonyFilesystem();
32
33
            return new Filesystem($symfonyFilesystem);
34
        });
35
36
        return $this;
37
    }
38
}
39