Completed
Push — develop ( e77623...3cc0f7 )
by Jens
09:01
created

MeGetRequest::httpRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[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
17
/**
18
 * @package Commercetools\Core\Request\Me
19
 * @method Customer mapResponse(ApiResponseInterface $response)
20
 */
21 View Code Duplication
class MeGetRequest extends AbstractApiRequest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    protected $resultClass = '\Commercetools\Core\Model\Customer\Customer';
24
25
    /**
26
     * @param Context $context
27
     */
28 4
    public function __construct(Context $context = null)
29
    {
30 4
        parent::__construct(MeEndpoint::endpoint(), $context);
31 4
    }
32
33
    /**
34
     * @param Context $context
35
     * @return static
36
     */
37 4
    public static function of(Context $context = null)
38
    {
39 4
        return new static($context);
40
    }
41
42
    /**
43
     * @return HttpRequest
44
     * @internal
45
     */
46 4
    public function httpRequest()
47
    {
48 4
        return new HttpRequest(HttpMethod::GET, $this->getPath());
49
    }
50
51
    /**
52
     * @param ResponseInterface $response
53
     * @return ResourceResponse
54
     * @internal
55
     */
56 3
    public function buildResponse(ResponseInterface $response)
57
    {
58 3
        return new ResourceResponse($response, $this, $this->getContext());
59
    }
60
}
61