IssuedInvoiceItemApiModelUpdate   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 34
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getEnumMap() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Fousky\Component\iDoklad\Model\IssuedInvoices;
4
5
use Fousky\Component\iDoklad\LOV\PriceTypeEnum;
6
use Fousky\Component\iDoklad\LOV\VatRateTypeEnum;
7
use Fousky\Component\iDoklad\Model\iDokladAbstractModel;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * @method null|float getAmount()
12
 * @method null|int getId()
13
 * @method null|string getName()
14
 * @method null|PriceTypeEnum getPriceType()
15
 * @method null|string getUnit()
16
 * @method null|float getUnitPrice()
17
 * @method null|VatRateTypeEnum getVatRateType()
18
 *
19
 * @author Lukáš Brzák <[email protected]>
20
 */
21 View Code Duplication
class IssuedInvoiceItemApiModelUpdate extends iDokladAbstractModel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /** @Assert\Type(type="float") */
24
    public $Amount;
25
26
    /** @Assert\IsNull(message="This value is readonly.") */
27
    public $Id;
28
29
    /** @Assert\Type(type="string") */
30
    public $Name;
31
32
    /** @Assert\Type(type="Fousky\Component\iDoklad\LOV\PriceTypeEnum") */
33
    public $PriceType;
34
35
    /** @Assert\Type(type="string") */
36
    public $Unit;
37
38
    /** @Assert\Type(type="float") */
39
    public $UnitPrice;
40
41
    /** @Assert\Type(type="Fousky\Component\iDoklad\LOV\VatRateTypeEnum") */
42
    public $VatRateType;
43
44
    /**
45
     * @return array
46
     */
47
    public static function getEnumMap(): array
48
    {
49
        return [
50
            'PriceType' => PriceTypeEnum::class,
51
            'VatRateType' => VatRateTypeEnum::class,
52
        ];
53
    }
54
}
55