Completed
Push — master ( 44676f...b7bc18 )
by Jens
13:18
created

ProjectGetRequest::of()   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 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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
use Commercetools\Core\Model\MapperInterface;
18
19
/**
20
 * @package Commercetools\Core\Request\Project
21
 * @link https://dev.commercetools.com/http-api-projects-project.html#get-project
22
 * @method Project mapResponse(ApiResponseInterface $response)
23
 * @method Project mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
24
 */
25 View Code Duplication
class ProjectGetRequest 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...
26
{
27
    protected $resultClass = Project::class;
28
29 9
    public function __construct(Context $context = null)
30
    {
31 9
        parent::__construct(new JsonEndpoint(''), $context);
32 9
    }
33
    /**
34
     * @param ResponseInterface $response
35
     * @return ResourceResponse
36
     * @internal
37
     */
38 8
    public function buildResponse(ResponseInterface $response)
39
    {
40 8
        return new ResourceResponse($response, $this, $this->getContext());
41
    }
42
43
    /**
44
     * @return HttpRequest
45
     * @internal
46
     */
47 8
    public function httpRequest()
48
    {
49 8
        return new HttpRequest(HttpMethod::GET, $this->getPath());
50
    }
51
52
    /**
53
     * @param Context $context
54
     * @return static
55
     */
56 9
    public static function of(Context $context = null)
57
    {
58 9
        return new static($context);
59
    }
60
}
61