Completed
Push — develop ( 5e8154...a89f38 )
by Jens
08:15
created

MyLineItemDraft   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 78.57 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 11
loc 14
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 @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Cart;
7
8
use Commercetools\Core\Model\Channel\ChannelReference;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Common\LocalizedString;
11
use Commercetools\Core\Model\Common\Money;
12
use Commercetools\Core\Model\Common\Price;
13
use Commercetools\Core\Model\Order\ItemState;
14
use Commercetools\Core\Model\Order\ItemStateCollection;
15
use Commercetools\Core\Model\Product\ProductVariant;
16
use Commercetools\Core\Model\TaxCategory\TaxRate;
17
use Commercetools\Core\Model\CustomField\CustomFieldObject;
18
use Commercetools\Core\Model\TaxCategory\ExternalTaxRateDraft;
19
20
/**
21
 * @package Commercetools\Core\Model\Cart
22
 * @link http://dev.commercetools.com/http-api-projects-me-carts.html#mylineitemdraft
23
 * @method string getProductId()
24
 * @method MyLineItemDraft setProductId(string $productId = null)
25
 * @method int getVariantId()
26
 * @method MyLineItemDraft setVariantId(int $variantId = null)
27
 * @method int getQuantity()
28
 * @method MyLineItemDraft setQuantity(int $quantity = null)
29
 * @method ChannelReference getSupplyChannel()
30
 * @method MyLineItemDraft setSupplyChannel(ChannelReference $supplyChannel = null)
31
 * @method ChannelReference getDistributionChannel()
32
 * @method MyLineItemDraft setDistributionChannel(ChannelReference $distributionChannel = null)
33
 * @method CustomFieldObject getCustom()
34
 * @method MyLineItemDraft setCustom(CustomFieldObject $custom = null)
35
 */
36
class MyLineItemDraft extends JsonObject
37
{
38 View Code Duplication
    public function fieldDefinitions()
0 ignored issues
show
Duplication introduced by
This method 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...
39
    {
40
        return [
41
            'productId' => [static::TYPE => 'string'],
42
            'variantId' => [static::TYPE => 'int'],
43
            'quantity' => [static::TYPE => 'int'],
44
            'supplyChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'],
45
            'distributionChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'],
46
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
47
        ];
48
    }
49
}
50