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

ProjectGetRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 36
ccs 5
cts 5
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A of() 0 4 1
A buildResponse() 0 4 1
A httpRequest() 0 4 1
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