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

CartByKeyGetRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 5
dl 0
loc 23
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A ofKey() 0 3 1
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