Code Duplication    Length = 32-37 lines in 3 locations

src/Request/Orders/OrderImportRequest.php 1 location

@@ 19-50 (lines=32) @@
16
 * @link https://dev.commercetools.com/http-api-projects-orders-import.html#create-order-by-import
17
 * @method Order mapResponse(ApiResponseInterface $response)
18
 */
19
class OrderImportRequest extends AbstractCreateRequest
20
{
21
    protected $resultClass = '\Commercetools\Core\Model\Order\Order';
22
23
    /**
24
     * @param ImportOrder $importOrder
25
     * @param Context $context
26
     */
27
    public function __construct(ImportOrder $importOrder, Context $context = null)
28
    {
29
        parent::__construct(OrdersEndpoint::endpoint(), $importOrder, $context);
30
    }
31
32
    /**
33
     * @param ImportOrder $importOrder
34
     * @param Context $context
35
     * @return static
36
     */
37
    public static function ofImportOrder(ImportOrder $importOrder, Context $context = null)
38
    {
39
        return new static($importOrder, $context);
40
    }
41
42
    /**
43
     * @return string
44
     * @internal
45
     */
46
    protected function getPath()
47
    {
48
        return (string)$this->getEndpoint() . '/import' . $this->getParamString();
49
    }
50
}
51

src/Request/Products/ProductProjectionByIdGetRequest.php 1 location

@@ 20-53 (lines=34) @@
17
 * @link https://dev.commercetools.com/http-api-projects-products.html#product-projection-by-id
18
 * @method ProductProjection mapResponse(ApiResponseInterface $response)
19
 */
20
class ProductProjectionByIdGetRequest extends AbstractByIdGetRequest
21
{
22
    use StagedTrait;
23
24
    protected $resultClass = '\Commercetools\Core\Model\Product\ProductProjection';
25
26
    /**
27
     * @param string $id
28
     * @param Context $context
29
     */
30
    public function __construct($id, Context $context = null)
31
    {
32
        parent::__construct(ProductProjectionEndpoint::endpoint(), $id, $context);
33
    }
34
35
    /**
36
     * @return string
37
     * @internal
38
     */
39
    protected function getPath()
40
    {
41
        return (string)$this->getEndpoint() . '/' . $this->getId() . $this->getParamString();
42
    }
43
44
    /**
45
     * @param string $id
46
     * @param Context $context
47
     * @return static
48
     */
49
    public static function ofId($id, Context $context = null)
50
    {
51
        return new static($id, $context);
52
    }
53
}
54

src/Request/Me/MeSignupRequest.php 1 location

@@ 20-56 (lines=37) @@
17
 * @package Commercetools\Core\Request\Me
18
 * @method CustomerSigninResult mapResponse(ApiResponseInterface $response)
19
 */
20
class MeSignupRequest extends AbstractCreateRequest
21
{
22
    protected $resultClass = '\Commercetools\Core\Model\Customer\CustomerSigninResult';
23
24
    /**
25
     * MeGetRequest constructor.
26
     * @param MyCustomerDraft $customer
27
     * @param Context $context
28
     */
29
    public function __construct(MyCustomerDraft $customer, Context $context = null)
30
    {
31
        parent::__construct(MeEndpoint::endpoint(), $customer, $context);
32
    }
33
34
    /**
35
     * @param MyCustomerDraft $customer
36
     * @param Context $context
37
     * @return static
38
     */
39
    public static function ofCustomer(MyCustomerDraft $customer, Context $context = null)
40
    {
41
        return new static($customer, $context);
42
    }
43
44
    /**
45
     * @return HttpRequest
46
     * @internal
47
     */
48
    public function httpRequest()
49
    {
50
        return new HttpRequest(
51
            HttpMethod::POST,
52
            (string)$this->getEndpoint() . '/signup' . $this->getParamString(),
53
            $this->getObject()
54
        );
55
    }
56
}
57