Test Failed
Push — develop ( 47e1b5...e72b23 )
by Jens
18:53 queued 15s
created

AbstractHeadRequest::getPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
c 1
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Commercetools\Core\Request;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Commercetools\Core\Client;
7
use Commercetools\Core\Client\HttpMethod;
8
use Commercetools\Core\Client\HttpRequest;
9
use Commercetools\Core\Client\JsonEndpoint;
10
use Commercetools\Core\Model\Common\Context;
11
use Commercetools\Core\Response\ResourceResponse;
12
13
/**
14
 * @package Commercetools\Core\Request
15
 * @method ResourceResponse executeWithClient(Client $client)
16
 */
17
abstract class AbstractHeadRequest extends AbstractApiRequest
18
{
19
    use QueryTrait;
20
21
    /**
22
     * @param JsonEndpoint $endpoint
23
     * @param Context $context
24
     */
25
    public function __construct(JsonEndpoint $endpoint, Context $context = null)
26
    {
27
        parent::__construct($endpoint, $context);
28
    }
29
30
    /**
31
     * @return string
32
     * @internal
33
     */
34
    protected function getPath()
35
    {
36
        return (string)$this->getEndpoint() . $this->getParamString();
37
    }
38
39
    /**
40
     * @return HttpRequest
41
     * @internal
42
     */
43
    public function httpRequest()
44
    {
45
        return new HttpRequest(HttpMethod::HEAD, $this->getPath());
46
    }
47
48
    /**
49
     * @param ResponseInterface $response
50
     * @return ResourceResponse
51
     * @internal
52
     */
53
    public function buildResponse(ResponseInterface $response)
54
    {
55
        return new ResourceResponse($response, $this, $this->getContext());
56
    }
57
}
58