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

LineItemDraft   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\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
19
/**
20
 * @package Commercetools\Core\Model\Cart
21
 * @apidoc http://dev.sphere.io/http-api-projects-carts.html#line-item
22
 * @method string getProductId()
23
 * @method LineItemDraft setProductId(string $productId = null)
24
 * @method int getVariantId()
25
 * @method LineItemDraft setVariantId(int $variantId = null)
26
 * @method int getQuantity()
27
 * @method LineItemDraft setQuantity(int $quantity = null)
28
 * @method ChannelReference getSupplyChannel()
29
 * @method LineItemDraft setSupplyChannel(ChannelReference $supplyChannel = null)
30
 * @method ChannelReference getDistributionChannel()
31
 * @method LineItemDraft setDistributionChannel(ChannelReference $distributionChannel = null)
32
 * @method CustomFieldObject getCustom()
33
 * @method LineItemDraft setCustom(CustomFieldObject $custom = null)
34
 */
35 View Code Duplication
class LineItemDraft 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...
36
{
37
    public function fieldDefinitions()
38
    {
39
        return [
40
            'productId' => [static::TYPE => 'string'],
41
            'variantId' => [static::TYPE => 'int'],
42
            'quantity' => [static::TYPE => 'int'],
43
            'supplyChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'],
44
            'distributionChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'],
45
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
46
        ];
47
    }
48
}
49