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-email-token |
23
|
|
|
* @method Customer mapResponse(ApiResponseInterface $response) |
24
|
|
|
* @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
25
|
|
|
*/ |
26
|
|
View Code Duplication |
class CustomerByEmailTokenGetRequest extends AbstractByTokenGetRequest |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
const TOKEN_NAME = 'email-token'; |
29
|
|
|
|
30
|
|
|
protected $resultClass = Customer::class; |
31
|
|
|
/** |
32
|
|
|
* @param string $token |
33
|
|
|
* @param Context $context |
34
|
|
|
*/ |
35
|
1 |
|
public function __construct($token, Context $context = null) |
36
|
|
|
{ |
37
|
1 |
|
parent::__construct(CustomersEndpoint::endpoint(), $token, $context); |
38
|
1 |
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param string $token |
42
|
|
|
* @param Context $context |
43
|
|
|
* @return static |
44
|
|
|
*/ |
45
|
1 |
|
public static function ofToken($token, Context $context = null) |
46
|
|
|
{ |
47
|
1 |
|
return new static($token, $context); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
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.