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

MeCartUpdateRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 4
crap 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