|
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
|
|
|
|