|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of riesenia/pohoda package. |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the MIT License |
|
7
|
|
|
* (c) RIESENIA.com |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace Riesenia\Pohoda\Type; |
|
13
|
|
|
|
|
14
|
|
|
use Riesenia\Pohoda\AbstractAgenda; |
|
15
|
|
|
use Riesenia\Pohoda\Common; |
|
16
|
|
|
use Riesenia\Pohoda\ValueTransformer\SanitizeEncoding; |
|
17
|
|
|
|
|
18
|
|
|
class CurrencyHome extends AbstractAgenda |
|
19
|
|
|
{ |
|
20
|
|
|
use Common\SetNamespaceTrait; |
|
21
|
|
|
|
|
22
|
|
|
/** @var string[] */ |
|
23
|
|
|
protected array $refElements = ['round']; |
|
24
|
|
|
|
|
25
|
|
|
/** @var string[] */ |
|
26
|
|
|
protected array $elements = ['priceNone', 'price3', 'price3VAT', 'price3Sum', 'priceLow', 'priceLowVAT', 'priceLowVatRate', 'priceLowSum', 'priceHigh', 'priceHighVAT', 'priceHighVatRate', 'priceHighSum', 'round']; |
|
27
|
|
|
|
|
28
|
4 |
|
public function __construct( |
|
29
|
|
|
Common\NamespacesPaths $namespacesPaths, |
|
30
|
|
|
SanitizeEncoding $sanitizeEncoding, |
|
31
|
|
|
Common\OptionsResolver\Normalizers\NormalizerFactory $normalizerFactory = new Common\OptionsResolver\Normalizers\NormalizerFactory(), |
|
32
|
|
|
) { |
|
33
|
|
|
// init attributes |
|
34
|
4 |
|
$this->elementsAttributesMapper = [ |
|
35
|
4 |
|
'priceLowVatRate' => new Common\ElementAttributes('priceLowVAT', 'rate'), |
|
36
|
4 |
|
'priceHighVatRate' => new Common\ElementAttributes('priceHighVAT', 'rate'), |
|
37
|
4 |
|
]; |
|
38
|
|
|
|
|
39
|
4 |
|
parent::__construct($namespacesPaths, $sanitizeEncoding, $normalizerFactory); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* {@inheritdoc} |
|
44
|
|
|
*/ |
|
45
|
1 |
|
protected function configureOptions(Common\OptionsResolver $resolver): void |
|
46
|
|
|
{ |
|
47
|
|
|
// available options |
|
48
|
1 |
|
$resolver->setDefined($this->elements); |
|
49
|
|
|
|
|
50
|
|
|
// validate / format options |
|
51
|
1 |
|
$resolver->setNormalizer('priceNone', $this->normalizerFactory->getClosure('float')); |
|
52
|
1 |
|
$resolver->setNormalizer('price3', $this->normalizerFactory->getClosure('float')); |
|
53
|
1 |
|
$resolver->setNormalizer('price3VAT', $this->normalizerFactory->getClosure('float')); |
|
54
|
1 |
|
$resolver->setNormalizer('price3Sum', $this->normalizerFactory->getClosure('float')); |
|
55
|
1 |
|
$resolver->setNormalizer('priceLow', $this->normalizerFactory->getClosure('float')); |
|
56
|
1 |
|
$resolver->setNormalizer('priceLowVAT', $this->normalizerFactory->getClosure('float')); |
|
57
|
1 |
|
$resolver->setNormalizer('priceLowVatRate', $this->normalizerFactory->getClosure('float')); |
|
58
|
1 |
|
$resolver->setNormalizer('priceLowSum', $this->normalizerFactory->getClosure('float')); |
|
59
|
1 |
|
$resolver->setNormalizer('priceHigh', $this->normalizerFactory->getClosure('float')); |
|
60
|
1 |
|
$resolver->setNormalizer('priceHighVAT', $this->normalizerFactory->getClosure('float')); |
|
61
|
1 |
|
$resolver->setNormalizer('priceHighVatRate', $this->normalizerFactory->getClosure('float')); |
|
62
|
1 |
|
$resolver->setNormalizer('priceHighSum', $this->normalizerFactory->getClosure('float')); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|