Passed
Push — develop ( f8140e...dbb7b9 )
by Jens
10:17
created

ZoneByKeyGetRequest::ofKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 */
4
5
namespace Commercetools\Core\Request\Zones;
6
7
use Commercetools\Core\Model\Common\Context;
8
use Commercetools\Core\Model\Zone\Zone;
9
use Commercetools\Core\Request\AbstractByKeyGetRequest;
10
use Commercetools\Core\Model\MapperInterface;
11
use Commercetools\Core\Response\ApiResponseInterface;
12
13
/**
14
 * @package Commercetools\Core\Request\Zones
15
 * @link https://docs.commercetools.com/http-api-projects-zones.html#get-zone-by-key
16
 * @method Zone mapResponse(ApiResponseInterface $response)
17
 * @method Zone mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
18
 */
19
class ZoneByKeyGetRequest extends AbstractByKeyGetRequest
20
{
21
    protected $resultClass = Zone::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(ZonesEndpoint::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