Code Duplication    Length = 28-28 lines in 2 locations

src/Doctrine/ODM/DoctrineServiceProvider.php 1 location

@@ 10-37 (lines=28) @@
7
use Nord\Lumen\FileManager\Contracts\FileStorage as FileStorageContract;
8
use Nord\Lumen\FileManager\Doctrine\FileFactory;
9
10
class DoctrineServiceProvider extends ServiceProvider
11
{
12
13
    /**
14
     * @inheritdoc
15
     */
16
    public function register()
17
    {
18
        $this->registerContainerBindings($this->app);
19
    }
20
21
22
    /**
23
     * @param Container $container
24
     */
25
    protected function registerContainerBindings(Container $container)
26
    {
27
        $container->singleton(FileFactoryContract::class, function () {
28
            return new FileFactory(File::class);
29
        });
30
31
        $documentManager = $container->make(DocumentManager::class);
32
33
        $container->singleton(FileStorageContract::class, function () use ($documentManager) {
34
            return new FileStorage($documentManager);
35
        });
36
    }
37
}
38

src/Doctrine/ORM/DoctrineServiceProvider.php 1 location

@@ 10-37 (lines=28) @@
7
use Nord\Lumen\FileManager\Contracts\FileStorage as FileStorageContract;
8
use Nord\Lumen\FileManager\Doctrine\FileFactory;
9
10
class DoctrineServiceProvider extends ServiceProvider
11
{
12
13
    /**
14
     * @inheritdoc
15
     */
16
    public function register()
17
    {
18
        $this->registerContainerBindings($this->app);
19
    }
20
21
22
    /**
23
     * @param Container $container
24
     */
25
    protected function registerContainerBindings(Container $container)
26
    {
27
        $container->singleton(FileFactoryContract::class, function () {
28
            return new FileFactory(File::class);
29
        });
30
31
        $entityManager = $container->make(EntityManagerInterface::class);
32
33
        $container->singleton(FileStorageContract::class, function () use ($entityManager) {
34
            return new FileStorage($entityManager);
35
        });
36
    }
37
}
38