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

CartByKeyGetRequest::__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 2
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\AbstractByKeyGetRequest;
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#get-a-cart-by-key
16
 * @method Cart mapResponse(ApiResponseInterface $response)
17
 * @method Cart mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
18
 * @method CartByKeyGetRequest|InStoreRequestDecorator inStore($storeKey)
19
 */
20
class CartByKeyGetRequest extends AbstractByKeyGetRequest
21
{
22
    use InStoreTrait;
23
24
    protected $resultClass = Cart::class;
25
26
    /**
27
     * @param string $key
28
     * @param Context $context
29
     */
30
    public function __construct($key, Context $context = null)
31
    {
32
        parent::__construct(CartsEndpoint::endpoint(), $key, $context);
33
    }
34
35
    /**
36
     * @param string $key
37
     * @param Context $context
38
     * @return static
39
     */
40
    public static function ofKey($key, Context $context = null)
41
    {
42
        return new static($key, $context);
43
    }
44
}
45