Completed
Push — develop ( dfae98...8b2ab3 )
by
unknown
17:22 queued 05:52
created

CustomLineItemDraft   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 1
dl 14
loc 14
ccs 0
cts 11
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 11 11 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
 * @author @ct-jensschulze <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Cart;
7
8
use Commercetools\Core\Model\Common\JsonObject;
9
use Commercetools\Core\Model\Common\LocalizedString;
10
use Commercetools\Core\Model\Common\Money;
11
use Commercetools\Core\Model\Order\ItemState;
12
use Commercetools\Core\Model\TaxCategory\TaxCategoryReference;
13
use Commercetools\Core\Model\TaxCategory\TaxRate;
14
use Commercetools\Core\Model\CustomField\CustomFieldObject;
15
16
/**
17
 * @package Commercetools\Core\Model\Cart
18
 * @apidoc http://dev.sphere.io/http-api-projects-carts.html#custom-line-item
19
 * @method LocalizedString getName()
20
 * @method CustomLineItemDraft setName(LocalizedString $name = null)
21
 * @method Money getMoney()
22
 * @method CustomLineItemDraft setMoney(Money $money = null)
23
 * @method LocalizedString getSlug()
24
 * @method CustomLineItemDraft setSlug(LocalizedString $slug = null)
25
 * @method int getQuantity()
26
 * @method CustomLineItemDraft setQuantity(int $quantity = null)
27
 * @method TaxCategoryReference getTaxCategory()
28
 * @method CustomLineItemDraft setTaxCategory(TaxCategoryReference $taxCategory = null)
29
 * @method CustomFieldObject getCustom()
30
 * @method CustomLineItemDraft setCustom(CustomFieldObject $custom = null)
31
 */
32 View Code Duplication
class CustomLineItemDraft extends JsonObject
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...
33
{
34
    public function fieldDefinitions()
35
    {
36
        return [
37
            'name' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
38
            'money' => [static::TYPE => '\Commercetools\Core\Model\Common\Money'],
39
            'slug' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
40
            'quantity' => [static::TYPE => 'int'],
41
            'taxCategory' => [static::TYPE => '\Commercetools\Core\Model\TaxCategory\TaxCategoryReference'],
42
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
43
        ];
44
    }
45
}
46