MediaLibraryModuleServiceProvider   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
dl 0
loc 33
ccs 0
cts 15
cp 0
rs 10
c 1
b 0
f 1
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A registerResources() 0 11 3
A register() 0 2 1
A provides() 0 3 1
A boot() 0 3 1
1
<?php
2
3
namespace ByTIC\MediaLibraryModule;
4
5
use Nip\Container\ServiceProviders\Providers\AbstractSignatureServiceProvider;
6
use Nip\Container\ServiceProviders\Providers\BootableServiceProviderInterface;
7
8
/**
9
 * Class MediaLibraryModuleServiceProvider.
10
 */
11
class MediaLibraryModuleServiceProvider extends AbstractSignatureServiceProvider implements BootableServiceProviderInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function provides()
17
    {
18
        return [];
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function register()
25
    {
26
    }
27
28
    public function boot()
29
    {
30
        $this->registerResources();
31
    }
32
33
    protected function registerResources()
34
    {
35
        $folder = __DIR__ . '/resources/lang/';
36
        $languages = $this->getContainer()->get('translation.languages');
37
38
        $translator = $this->getContainer()->get('translator');
39
40
        foreach ($languages as $language) {
41
            $path = $folder . $language;
42
            if (is_dir($path)) {
43
                $translator->addResource('php', $path, $language);
44
            }
45
        }
46
    }
47
}
48