Item::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 15
ccs 12
cts 12
cp 1
rs 9.9
cc 1
nc 1
nop 1
crap 1
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\IssueSlip;
13
14
use Riesenia\Pohoda\Common\OptionsResolver;
15
use Riesenia\Pohoda\Document\AbstractItem;
16
17
class Item extends AbstractItem
18
{
19
    /** @var string[] */
20
    protected array $refElements = ['typeServiceMOSS', 'centre', 'activity', 'contract'];
21
22
    /** @var string[] */
23
    protected array $elements = ['text', 'quantity', 'unit', 'coefficient', 'payVAT', 'rateVAT', 'percentVAT', 'discountPercentage', 'homeCurrency', 'foreignCurrency', 'typeServiceMOSS', 'note', 'code', 'stockItem', 'centre', 'activity', 'contract'];
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    protected function configureOptions(OptionsResolver $resolver): void
29
    {
30 1
        parent::configureOptions($resolver);
31
32
        // validate / format options
33 1
        $resolver->setNormalizer('text', $this->normalizerFactory->getClosure('string90'));
34 1
        $resolver->setNormalizer('quantity', $this->normalizerFactory->getClosure('float'));
35 1
        $resolver->setNormalizer('unit', $this->normalizerFactory->getClosure('string10'));
36 1
        $resolver->setNormalizer('coefficient', $this->normalizerFactory->getClosure('float'));
37 1
        $resolver->setNormalizer('payVAT', $this->normalizerFactory->getClosure('bool'));
38 1
        $resolver->setAllowedValues('rateVAT', ['none', 'high', 'low', 'third', 'historyHigh', 'historyLow', 'historyThird']);
39 1
        $resolver->setNormalizer('percentVAT', $this->normalizerFactory->getClosure('int'));
40 1
        $resolver->setNormalizer('discountPercentage', $this->normalizerFactory->getClosure('float'));
41 1
        $resolver->setNormalizer('note', $this->normalizerFactory->getClosure('string90'));
42 1
        $resolver->setNormalizer('code', $this->normalizerFactory->getClosure('string64'));
43
    }
44
}
45