Completed
Push — master ( f73df0...286c6f )
by Markus
23s queued 12s
created

FilesystemSymfonyServiceProvider::addFilesystem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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