Code Duplication    Length = 21-25 lines in 6 locations

src/Core/Request/Customers/CustomerByEmailTokenGetRequest.php 1 location

@@ 26-49 (lines=24) @@
23
 * @method Customer mapResponse(ApiResponseInterface $response)
24
 * @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
25
 */
26
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
    public function __construct($token, Context $context = null)
36
    {
37
        parent::__construct(CustomersEndpoint::endpoint(), $token, $context);
38
    }
39
40
    /**
41
     * @param string $token
42
     * @param Context $context
43
     * @return static
44
     */
45
    public static function ofToken($token, Context $context = null)
46
    {
47
        return new static($token, $context);
48
    }
49
}
50

src/Core/Request/Customers/CustomerByIdGetRequest.php 1 location

@@ 21-43 (lines=23) @@
18
 * @method Customer mapResponse(ApiResponseInterface $response)
19
 * @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
20
 */
21
class CustomerByIdGetRequest extends AbstractByIdGetRequest
22
{
23
    protected $resultClass = Customer::class;
24
25
    /**
26
     * @param string $id
27
     * @param Context $context
28
     */
29
    public function __construct($id, Context $context = null)
30
    {
31
        parent::__construct(CustomersEndpoint::endpoint(), $id, $context);
32
    }
33
34
    /**
35
     * @param string $id
36
     * @param Context $context
37
     * @return static
38
     */
39
    public static function ofId($id, Context $context = null)
40
    {
41
        return new static($id, $context);
42
    }
43
}
44

src/Core/Request/Customers/CustomerByTokenGetRequest.php 1 location

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

src/Core/Request/Customers/CustomerCreateRequest.php 1 location

@@ 23-45 (lines=23) @@
20
 * @method CustomerSigninResult mapResponse(ApiResponseInterface $response)
21
 * @method CustomerSigninResult mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
22
 */
23
class CustomerCreateRequest extends AbstractCreateRequest
24
{
25
    protected $resultClass = CustomerSigninResult::class;
26
27
    /**
28
     * @param CustomerDraft $customer
29
     * @param Context $context
30
     */
31
    public function __construct(CustomerDraft $customer, Context $context = null)
32
    {
33
        parent::__construct(CustomersEndpoint::endpoint(), $customer, $context);
34
    }
35
36
    /**
37
     * @param CustomerDraft $customer
38
     * @param Context $context
39
     * @return static
40
     */
41
    public static function ofDraft(CustomerDraft $customer, Context $context = null)
42
    {
43
        return new static($customer, $context);
44
    }
45
}
46

src/Core/Request/Customers/CustomerDeleteRequest.php 1 location

@@ 21-45 (lines=25) @@
18
 * @method Customer mapResponse(ApiResponseInterface $response)
19
 * @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
20
 */
21
class CustomerDeleteRequest extends AbstractDeleteRequest
22
{
23
    protected $resultClass = Customer::class;
24
25
    /**
26
     * @param string $id
27
     * @param int $version
28
     * @param Context $context
29
     */
30
    public function __construct($id, $version, Context $context = null)
31
    {
32
        parent::__construct(CustomersEndpoint::endpoint(), $id, $version, $context);
33
    }
34
35
    /**
36
     * @param string $id
37
     * @param int $version
38
     * @param Context $context
39
     * @return static
40
     */
41
    public static function ofIdAndVersion($id, $version, Context $context = null)
42
    {
43
        return new static($id, $version, $context);
44
    }
45
}
46

src/Core/Request/Customers/CustomerQueryRequest.php 1 location

@@ 21-41 (lines=21) @@
18
 * @method CustomerCollection mapResponse(ApiResponseInterface $response)
19
 * @method CustomerCollection mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
20
 */
21
class CustomerQueryRequest extends AbstractQueryRequest
22
{
23
    protected $resultClass = CustomerCollection::class;
24
25
    /**
26
     * @param Context $context
27
     */
28
    public function __construct(Context $context = null)
29
    {
30
        parent::__construct(CustomersEndpoint::endpoint(), $context);
31
    }
32
33
    /**
34
     * @param Context $context
35
     * @return static
36
     */
37
    public static function of(Context $context = null)
38
    {
39
        return new static($context);
40
    }
41
}
42