Test Failed
Pull Request — develop (#494)
by nikos
12:32
created

ProductDiscountByKeyGetRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
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 __construct() 0 3 1
A ofKey() 0 3 1
1
<?php
2
/**
3
 */
4
5
namespace Commercetools\Core\Request\ProductDiscounts;
6
7
use Commercetools\Core\Model\ProductDiscount\ProductDiscount;
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractByKeyGetRequest;
10
use Commercetools\Core\Response\ApiResponseInterface;
11
use Commercetools\Core\Model\MapperInterface;
12
13
/**
14
 * @package Commercetools\Core\Request\ProductDiscounts
15
 *
16
 * @method ProductDiscount mapResponse(ApiResponseInterface $response)
17
 * @method ProductDiscount mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
18
 */
19
class ProductDiscountByKeyGetRequest extends AbstractByKeyGetRequest
20
{
21
    protected $resultClass = ProductDiscount::class;
22
23
    /**
24
     * @param string $key
25
     * @param Context $context
26
     */
27 1
    public function __construct($key, Context $context = null)
28
    {
29 1
        parent::__construct(ProductDiscountsEndpoint::endpoint(), $key, $context);
30 1
    }
31
32
    /**
33
     * @param string $key
34
     * @param Context $context
35
     * @return static
36
     */
37 1
    public static function ofKey($key, Context $context = null)
38
    {
39 1
        return new static($key, $context);
40
    }
41
}
42