Passed
Push — develop ( f53d0b...3a55e6 )
by Jens
09:08
created

ShippingMethodByKeyGetRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofKey() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\ShippingMethods;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\ShippingMethod\ShippingMethod;
10
use Commercetools\Core\Request\AbstractByKeyGetRequest;
11
use Commercetools\Core\Response\ApiResponseInterface;
12
use Commercetools\Core\Model\MapperInterface;
13
14
/**
15
 * @package Commercetools\Core\Request\ShippingMethods
16
 * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethod-by-key
17
 * @method ShippingMethod mapResponse(ApiResponseInterface $response)
18
 * @method ShippingMethod mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
19
 */
20
class ShippingMethodByKeyGetRequest extends AbstractByKeyGetRequest
21
{
22
    protected $resultClass = ShippingMethod::class;
23
24
    /**
25
     * @param string $key
26
     * @param Context $context
27
     */
28 3
    public function __construct($key, Context $context = null)
29
    {
30 3
        parent::__construct(ShippingMethodsEndpoint::endpoint(), $key, $context);
31 3
    }
32
33
    /**
34
     * @param string $key
35
     * @param Context $context
36
     * @return static
37
     */
38 3
    public static function ofKey($key, Context $context = null)
39
    {
40 3
        return new static($key, $context);
41
    }
42
}
43