Passed
Push — develop ( 1795ba...79eaf3 )
by Jens
25:35 queued 03:06
created

MeCartUpdateRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
c 0
b 0
f 0
dl 0
loc 26
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofIdAndVersion() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Me;
7
8
use Commercetools\Core\Model\Cart\Cart;
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Request\AbstractUpdateRequest;
11
use Commercetools\Core\Request\InStores\InStoreRequestDecorator;
12
use Commercetools\Core\Request\InStores\InStoreTrait;
13
use Commercetools\Core\Response\ApiResponseInterface;
14
use Commercetools\Core\Model\MapperInterface;
15
16
/**
17
 * @package Commercetools\Core\Request\Me
18
 * @link https://docs.commercetools.com/http-api-projects-me-carts.html#update-cart
19
 * @method Cart mapResponse(ApiResponseInterface $response)
20
 * @method Cart mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
21
 * @method MeCartUpdateRequest|InStoreRequestDecorator inStore($storeKey)
22
 */
23
class MeCartUpdateRequest extends AbstractUpdateRequest
24
{
25
    use InStoreTrait;
26
27
    protected $resultClass = Cart::class;
28
29
    /**
30
     * @param string $id
31
     * @param int $version
32
     * @param array $actions
33
     * @param Context $context
34
     */
35 1
    public function __construct($id, $version, array $actions = [], Context $context = null)
36
    {
37 1
        parent::__construct(MeCartsEndpoint::endpoint(), $id, $version, $actions, $context);
38 1
    }
39
40
    /**
41
     * @param string $id
42
     * @param int $version
43
     * @param Context $context
44
     * @return static
45
     */
46 1
    public static function ofIdAndVersion($id, $version, Context $context = null)
47
    {
48 1
        return new static($id, $version, [], $context);
49
    }
50
}
51