Passed
Branch php-scrutinizer (9ddcba)
by Jens
09:45
created

SubscriptionByKeyGetRequest::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Subscriptions;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Subscription\Subscription;
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\Subscriptions
16
 * @method Subscription mapResponse(ApiResponseInterface $response)
17
 * @method Subscription mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
18
 */
19
class SubscriptionByKeyGetRequest extends AbstractByKeyGetRequest
20
{
21
    protected $resultClass = Subscription::class;
22
23
    /**
24
     * @param string $key
25
     * @param Context $context
26
     */
27
    public function __construct($key, Context $context = null)
28
    {
29
        parent::__construct(SubscriptionsEndpoint::endpoint(), $key, $context);
30
    }
31
32
    /**
33
     * @param string $key
34
     * @param Context $context
35
     * @return static
36
     */
37
    public static function ofKey($key, Context $context = null)
38
    {
39
        return new static($key, $context);
40
    }
41
}
42