Passed
Pull Request — develop (#423)
by nikos
09:13
created

CustomLineItem   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 2
eloc 17
dl 0
loc 31
ccs 14
cts 16
cp 0.875
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 0 18 1
A setDiscountedPricePerQuantity() 0 4 1
1
<?php
2
/**
3
 * @author @jenschude <[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
use Commercetools\Core\Model\Common\TaxedItemPrice;
16
17
/**
18
 * @package Commercetools\Core\Model\Cart
19
 * @link https://docs.commercetools.com/http-api-projects-carts.html#customlineitem
20
 * @method string getId()
21
 * @method CustomLineItem setId(string $id = null)
22
 * @method LocalizedString getName()
23
 * @method CustomLineItem setName(LocalizedString $name = null)
24
 * @method Money getMoney()
25
 * @method CustomLineItem setMoney(Money $money = null)
26
 * @method string getSlug()
27
 * @method CustomLineItem setSlug(string $slug = null)
28
 * @method int getQuantity()
29
 * @method CustomLineItem setQuantity(int $quantity = null)
30
 * @method ItemState getState()
31
 * @method CustomLineItem setState(ItemState $state = null)
32
 * @method TaxCategoryReference getTaxCategory()
33
 * @method CustomLineItem setTaxCategory(TaxCategoryReference $taxCategory = null)
34
 * @method TaxRate getTaxRate()
35
 * @method CustomLineItem setTaxRate(TaxRate $taxRate = null)
36
 * @method CustomFieldObject getCustom()
37
 * @method CustomLineItem setCustom(CustomFieldObject $custom = null)
38
 * @method Money getTotalPrice()
39
 * @method CustomLineItem setTotalPrice(Money $totalPrice = null)
40
 * @method DiscountedPricePerQuantityCollection getDiscountedPricePerQuantity()
41
 * @method TaxedItemPrice getTaxedPrice()
42
 * @method CustomLineItem setTaxedPrice(TaxedItemPrice $taxedPrice = null)
43
 * @method ItemShippingDetails getShippingDetails()
44
 * @method CustomLineItem setShippingDetails(ItemShippingDetails $shippingDetails = null)
45
 */
46
class CustomLineItem extends JsonObject
47
{
48 22
    public function fieldDefinitions()
49
    {
50
        return [
51 22
            'id' => [static::TYPE => 'string'],
52 22
            'name' => [static::TYPE => LocalizedString::class],
53 22
            'money' => [static::TYPE => Money::class],
54 22
            'taxedPrice' => [static::TYPE => TaxedItemPrice::class],
55 22
            'slug' => [static::TYPE => 'string'],
56 22
            'quantity' => [static::TYPE => 'int'],
57 22
            'state' => [static::TYPE => ItemState::class],
58 22
            'taxCategory' => [static::TYPE => TaxCategoryReference::class],
59 22
            'taxRate' => [static::TYPE => TaxRate::class],
60 22
            'custom' => [static::TYPE => CustomFieldObject::class],
61 22
            'totalPrice' => [static::TYPE => Money::class],
62
            'discountedPricePerQuantity' => [
63 22
                static::TYPE => DiscountedPricePerQuantityCollection::class
64
            ],
65 22
            'shippingDetails' => [static::TYPE => ItemShippingDetails::class],
66
        ];
67
    }
68
69
    /**
70
     * @param DiscountedPricePerQuantityCollection $discountedPricePerQuantity
71
     * @return static
72
     */
73
    public function setDiscountedPricePerQuantity(
74
        DiscountedPricePerQuantityCollection $discountedPricePerQuantity = null
75
    ) {
76
        return parent::setDiscountedPricePerQuantity($discountedPricePerQuantity);
0 ignored issues
show
introduced by
The method setDiscountedPricePerQuantity() does not exist on Commercetools\Core\Model\Common\JsonObject. Maybe you want to declare this class abstract? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

76
        return parent::/** @scrutinizer ignore-call */ setDiscountedPricePerQuantity($discountedPricePerQuantity);
Loading history...
77
    }
78
}
79