MoneyServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 41
ccs 0
cts 18
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 6 1
A registerCurrency() 0 3 1
A registerFormatter() 0 4 1
A register() 0 5 1
A registerCurrencies() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace ByTIC\Money;
5
6
use ByTIC\Assets\Encore\EntrypointLookupFactory;
7
use ByTIC\Assets\Encore\EntrypointsCollection;
8
use ByTIC\Money\Formatter\Manager;
9
use Money\Currencies\ISOCurrencies;
10
use Nip\Container\ServiceProviders\Providers\AbstractSignatureServiceProvider;
11
use Symfony\Component\Asset\Package;
12
use Symfony\Component\Asset\Packages;
13
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
14
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollection;
15
use Symfony\WebpackEncoreBundle\Asset\TagRenderer;
16
17
/**
18
 * Class MoneyServiceProvider
19
 * @package ByTIC\Money
20
 */
21
class MoneyServiceProvider extends AbstractSignatureServiceProvider
22
{
23
    public const NAME = 'money';
24
25
    public const MONEY_CURRENCIES = 'money.currencies';
26
    /**
27
     * @inheritDoc
28
     */
29
    public function provides()
30
    {
31
        return [
32
            self::MONEY_CURRENCIES,
33
            'money.currency',
34
            'money.formatter',
35
        ];
36
    }
37
38
    public function register()
39
    {
40
        $this->registerCurrencies();
41
        $this->registerCurrency();
42
        $this->registerFormatter();
43
    }
44
45
    protected function registerCurrencies()
46
    {
47
        $this->getContainer()->share(self::MONEY_CURRENCIES, function () {
48
            return new ISOCurrencies();
49
        });
50
    }
51
52
    protected function registerCurrency()
53
    {
54
        $this->getContainer()->share('money.currency', function () {
55
        });
56
    }
57
58
    protected function registerFormatter()
59
    {
60
        $this->getContainer()->share('money.formatter', function () {
61
            return Manager::instance();
62
        });
63
    }
64
}
65