Completed
Push — develop ( 991012...b60d88 )
by Jens
08:17
created

ProjectGetRequest::buildResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Project;
7
8
use Psr\Http\Message\ResponseInterface;
9
use Commercetools\Core\Client\HttpMethod;
10
use Commercetools\Core\Client\HttpRequest;
11
use Commercetools\Core\Client\JsonEndpoint;
12
use Commercetools\Core\Model\Common\Context;
13
use Commercetools\Core\Request\AbstractApiRequest;
14
use Commercetools\Core\Response\ResourceResponse;
15
use Commercetools\Core\Model\Project\Project;
16
use Commercetools\Core\Response\ApiResponseInterface;
17
18
/**
19
 * @package Commercetools\Core\Request\Project
20
 * @link https://dev.commercetools.com/http-api-projects-project.html#get-project
21
 * @method Project mapResponse(ApiResponseInterface $response)
22
 */
23
class ProjectGetRequest extends AbstractApiRequest
24
{
25
    protected $resultClass = '\Commercetools\Core\Model\Project\Project';
26
27 1
    public function __construct(Context $context = null)
28
    {
29 1
        parent::__construct(new JsonEndpoint(''), $context);
30 1
    }
31
    /**
32
     * @param ResponseInterface $response
33
     * @return ResourceResponse
34
     * @internal
35
     */
36
    public function buildResponse(ResponseInterface $response)
37
    {
38
        return new ResourceResponse($response, $this, $this->getContext());
39
    }
40
41
    /**
42
     * @return HttpRequest
43
     * @internal
44
     */
45
    public function httpRequest()
46
    {
47
        return new HttpRequest(HttpMethod::GET, $this->getPath());
48
    }
49
50
    /**
51
     * @param Context $context
52
     * @return static
53
     */
54 1
    public static function of(Context $context = null)
55
    {
56 1
        return new static($context);
57
    }
58
}
59