Test Failed
Push — develop ( b3c44f...3a55d2 )
by Jens
10:53
created

MeGetRequest::__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
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Me;
7
8
use Commercetools\Core\Client\HttpMethod;
9
use Commercetools\Core\Client\HttpRequest;
10
use Commercetools\Core\Model\Common\Context;
11
use Commercetools\Core\Model\Customer\Customer;
12
use Commercetools\Core\Request\AbstractApiRequest;
13
use Commercetools\Core\Response\ApiResponseInterface;
14
use Commercetools\Core\Response\ResourceResponse;
15
use Psr\Http\Message\ResponseInterface;
16
use Commercetools\Core\Model\MapperInterface;
17
18
/**
19
 * @package Commercetools\Core\Request\Me
20
 * @link https://docs.commercetools.com/http-api-projects-me-profile.html#get-customer
21
 * @method Customer mapResponse(ApiResponseInterface $response)
22
 * @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
23
 */
24
class MeGetRequest extends AbstractApiRequest
25
{
26
    protected $resultClass = Customer::class;
27
28
    /**
29
     * @param Context $context
30
     */
31
    public function __construct(Context $context = null)
32
    {
33
        parent::__construct(MeEndpoint::endpoint(), $context);
34
    }
35
36
    /**
37
     * @param Context $context
38
     * @return static
39
     */
40
    public static function of(Context $context = null)
41
    {
42
        return new static($context);
43
    }
44
45
    /**
46
     * @return HttpRequest
47
     * @internal
48
     */
49
    public function httpRequest()
50
    {
51
        return new HttpRequest(HttpMethod::GET, $this->getPath());
52
    }
53
54
    /**
55
     * @param ResponseInterface $response
56
     * @return ResourceResponse
57
     * @internal
58
     */
59
    public function buildResponse(ResponseInterface $response)
60
    {
61
        return new ResourceResponse($response, $this, $this->getContext());
62
    }
63
}
64