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
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @package Commercetools\Core\Model\Cart |
21
|
|
|
* @link https://dev.commercetools.com/http-api-projects-carts.html#line-item-draft |
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 |
|
|
|
|
36
|
|
|
{ |
37
|
10 |
|
public function fieldDefinitions() |
38
|
|
|
{ |
39
|
|
|
return [ |
40
|
10 |
|
'productId' => [static::TYPE => 'string'], |
41
|
10 |
|
'variantId' => [static::TYPE => 'int'], |
42
|
10 |
|
'quantity' => [static::TYPE => 'int'], |
43
|
10 |
|
'supplyChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'], |
44
|
10 |
|
'distributionChannel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'], |
45
|
10 |
|
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'], |
46
|
|
|
]; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
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.