CreditNoteItemApiModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 80
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getEnumMap() 8 8 1
A getDateMap() 6 6 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\CreditNotes;
4
5
use Fousky\Component\iDoklad\LOV\IssuedInvoiceItemTypeEnum;
6
use Fousky\Component\iDoklad\LOV\PriceTypeEnum;
7
use Fousky\Component\iDoklad\LOV\VatRateTypeEnum;
8
use Fousky\Component\iDoklad\Model\iDokladAbstractModel;
9
10
/**
11
 * @method null|float getAmount()
12
 * @method null|string getCode()
13
 * @method null|\DateTime getDateLastChange()
14
 * @method null|int getId()
15
 * @method null|bool getIsRoundedItem()
16
 * @method null|bool getIsTaxMovement()
17
 * @method null|IssuedInvoiceItemTypeEnum getItemType()
18
 * @method null|string getName()
19
 * @method null|float getPrice()
20
 * @method null|int getPriceListItemId()
21
 * @method null|float getPriceTotalWithoutVat()
22
 * @method null|float getPriceTotalWithoutVatHc()
23
 * @method null|float getPriceTotalWithVat()
24
 * @method null|float getPriceTotalWithVatHc()
25
 * @method null|PriceTypeEnum getPriceType()
26
 * @method null|float getPriceUnitVat()
27
 * @method null|float getPriceUnitVatHc()
28
 * @method null|float getPriceUnitWithoutVat()
29
 * @method null|float getPriceUnitWithoutVatHc()
30
 * @method null|float getPriceUnitWithVat()
31
 * @method null|float getPriceUnitWithVatHc()
32
 * @method null|float getTotalPrice()
33
 * @method null|string getUnit()
34
 * @method null|float getUnitPrice()
35
 * @method null|float getVatRate()
36
 * @method null|VatRateTypeEnum getVatRateType()
37
 * @method null|float getVatTotal()
38
 * @method null|float getVatTotalHc()
39
 *
40
 * @author Lukáš Brzák <[email protected]>
41
 *
42
 * @see https://app.idoklad.cz/developer/Help/v2/cs/ResourceModel?modelName=CreditNoteItemApiModel
43
 */
44 View Code Duplication
class CreditNoteItemApiModel 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...
45
{
46
    public $Amount;
47
48
    public $Code;
49
50
    public $DateLastChange;
51
52
    public $Id;
53
54
    public $IsRoundedItem;
55
56
    public $IsTaxMovement;
57
58
    public $ItemType;
59
60
    public $Name;
61
62
    public $Price;
63
64
    public $PriceListItemId;
65
66
    public $PriceTotalWithoutVat;
67
68
    public $PriceTotalWithoutVatHc;
69
70
    public $PriceTotalWithVat;
71
72
    public $PriceTotalWithVatHc;
73
74
    public $PriceType;
75
76
    public $PriceUnitVat;
77
78
    public $PriceUnitVatHc;
79
80
    public $PriceUnitWithoutVat;
81
82
    public $PriceUnitWithoutVatHc;
83
84
    public $PriceUnitWithVat;
85
86
    public $PriceUnitWithVatHc;
87
88
    public $TotalPrice;
89
90
    public $Unit;
91
92
    public $UnitPrice;
93
94
    public $VatRate;
95
96
    public $VatRateType;
97
98
    public $VatTotal;
99
100
    public $VatTotalHc;
101
102
    /**
103
     * @return array
104
     */
105
    public static function getEnumMap(): array
106
    {
107
        return [
108
            'ItemType' => IssuedInvoiceItemTypeEnum::class,
109
            'PriceType' => PriceTypeEnum::class,
110
            'VatRateType' => VatRateTypeEnum::class,
111
        ];
112
    }
113
114
    /**
115
     * @return array
116
     */
117
    public static function getDateMap(): array
118
    {
119
        return [
120
            'DateLastChange',
121
        ];
122
    }
123
}
124