Completed
Push — develop ( 17c567...8b47e8 )
by Jens
08:20
created

MyCartDraft::setLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Cart;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Common\LocaleTrait;
11
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
12
use Commercetools\Core\Model\Common\Address;
13
use Commercetools\Core\Model\ShippingMethod\ShippingMethodReference;
14
15
/**
16
 * @package Commercetools\Core\Model\Cart
17
 * @link http://dev.commercetools.com/http-api-projects-me-carts.html#mycartdraft
18
 * @method string getCurrency()
19
 * @method MyCartDraft setCurrency(string $currency = null)
20
 * @method string getCustomerEmail()
21
 * @method MyCartDraft setCustomerEmail(string $customerEmail = null)
22
 * @method string getCountry()
23
 * @method MyCartDraft setCountry(string $country = null)
24
 * @method string getInventoryMode()
25
 * @method MyCartDraft setInventoryMode(string $inventoryMode = null)
26
 * @method MyLineItemDraftCollection getLineItems()
27
 * @method MyCartDraft setLineItems(MyLineItemDraftCollection $lineItems = null)
28
 * @method Address getShippingAddress()
29
 * @method MyCartDraft setShippingAddress(Address $shippingAddress = null)
30
 * @method Address getBillingAddress()
31
 * @method MyCartDraft setBillingAddress(Address $billingAddress = null)
32
 * @method ShippingMethodReference getShippingMethod()
33
 * @method MyCartDraft setShippingMethod(ShippingMethodReference $shippingMethod = null)
34
 * @method CustomFieldObjectDraft getCustom()
35
 * @method MyCartDraft setCustom(CustomFieldObjectDraft $custom = null)
36
 * @method string getLocale()
37
 */
38 View Code Duplication
class MyCartDraft 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...
39
{
40
    use LocaleTrait;
41
42 9
    public function fieldDefinitions()
43
    {
44
        return [
45 9
            'currency' => [static::TYPE => 'string'],
46 9
            'customerEmail' => [static::TYPE => 'string'],
47 9
            'country' => [static::TYPE => 'string'],
48 9
            'inventoryMode' => [static::TYPE => 'string'],
49 9
            'lineItems' => [static::TYPE => '\Commercetools\Core\Model\Cart\MyLineItemDraftCollection'],
50 9
            'shippingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
51 9
            'billingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
52 9
            'shippingMethod' => [static::TYPE => '\Commercetools\Core\Model\ShippingMethod\ShippingMethodReference'],
53 9
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
54 9
            'locale' => [static::TYPE => 'string'],
55
        ];
56
    }
57
58
    /**
59
     * @param string $currency
60
     * @param Context|callable $context
61
     * @return CartDraft
62
     */
63 9
    public static function ofCurrency($currency, $context = null)
64
    {
65 9
        $draft = static::of($context);
66 9
        return $draft->setCurrency($currency);
67
    }
68
}
69