Test Failed
Push — develop ( 99d0ad...a91eee )
by Jens
47:28 queued 25:36
created

CartUpdateByKeyRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 4
1
<?php
2
3
namespace Commercetools\Core\Request\Carts;
4
5
use Commercetools\Core\Model\Cart\Cart;
6
use Commercetools\Core\Model\Common\Context;
7
use Commercetools\Core\Request\AbstractUpdateByKeyRequest;
8
use Commercetools\Core\Request\InStores\InStoreRequestDecorator;
9
use Commercetools\Core\Request\InStores\InStoreTrait;
10
use Commercetools\Core\Response\ApiResponseInterface;
11
use Commercetools\Core\Model\MapperInterface;
12
13
/**
14
 * @package Commercetools\Core\Request\Carts
15
 * @link https://docs.commercetools.com/api/projects/carts#update-a-cart-by-key
16
 * @method Cart mapResponse(ApiResponseInterface $response)
17
 * @method Cart mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
18
 * @method CartUpdateByKeyRequest|InStoreRequestDecorator inStore($storeKey)
19
 */
20
class CartUpdateByKeyRequest extends AbstractUpdateByKeyRequest
21
{
22
    use InStoreTrait;
23
24
    protected $resultClass = Cart::class;
25
26
    /**
27
     * @param string $key
28
     * @param int $version
29
     * @param array $actions
30
     * @param Context $context
31
     */
32
    public function __construct($key, $version, array $actions = [], Context $context = null)
33
    {
34
        parent::__construct(CartsEndpoint::endpoint(), $key, $version, $actions, $context);
35
    }
36
37
    /**
38
     * @param string $key
39
     * @param int $version
40
     * @param Context $context
41
     * @return static
42
     */
43
    public static function ofKeyAndVersion($key, $version, Context $context = null)
44
    {
45
        return new static($key, $version, [], $context);
46
    }
47
}
48