Completed
Push — develop ( f146aa...02676e )
by Jens
08:33
created

CustomerByTokenGetRequest::buildResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
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
 * @created: 12.02.15, 10:35
5
 */
6
7
namespace Commercetools\Core\Request\Customers;
8
9
use Commercetools\Core\Request\AbstractByTokenGetRequest;
10
use Psr\Http\Message\ResponseInterface;
11
use Commercetools\Core\Client\HttpMethod;
12
use Commercetools\Core\Client\HttpRequest;
13
use Commercetools\Core\Model\Common\Context;
14
use Commercetools\Core\Request\AbstractApiRequest;
15
use Commercetools\Core\Response\ResourceResponse;
16
use Commercetools\Core\Model\Customer\Customer;
17
use Commercetools\Core\Response\ApiResponseInterface;
18
use Commercetools\Core\Model\MapperInterface;
19
20
/**
21
 * @package Commercetools\Core\Request\Customers
22
 * @link https://dev.commercetools.com/http-api-projects-customers.html#get-customer-by-password-token
23
 * @method Customer mapResponse(ApiResponseInterface $response)
24
 * @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
25
 */
26 View Code Duplication
class CustomerByTokenGetRequest extends AbstractByTokenGetRequest
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...
27
{
28
    const TOKEN_NAME = 'password-token';
29
30
    protected $resultClass = Customer::class;
31
    /**
32
     * @param string $token
33
     * @param Context $context
34
     */
35 6
    public function __construct($token, Context $context = null)
36
    {
37 6
        parent::__construct(CustomersEndpoint::endpoint(), $token, $context);
38 6
    }
39
40
    /**
41
     * @param string $token
42
     * @param Context $context
43
     * @return static
44
     */
45 6
    public static function ofToken($token, Context $context = null)
46
    {
47 6
        return new static($token, $context);
48
    }
49
}
50