Code Duplication    Length = 51-52 lines in 2 locations

src/Core/Request/Orders/OrderDeleteByOrderNumberRequest.php 1 location

@@ 20-70 (lines=51) @@
17
 * @method Order mapResponse(ApiResponseInterface $response)
18
 * @method Order mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
19
 */
20
class OrderDeleteByOrderNumberRequest extends AbstractDeleteRequest
21
{
22
    protected $resultClass = Order::class;
23
24
    /**
25
     * @param string $id
26
     * @param int $version
27
     * @param Context $context
28
     */
29
    public function __construct($id, $version, Context $context = null)
30
    {
31
        parent::__construct(OrdersEndpoint::endpoint(), $id, $version, $context);
32
    }
33
34
    /**
35
     * @param string $orderNumber
36
     * @param int $version
37
     * @param Context $context
38
     * @return static
39
     */
40
    public static function ofOrderNumberAndVersion($orderNumber, $version, Context $context = null)
41
    {
42
        return new static($orderNumber, $version, $context);
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getOrderNumber()
49
    {
50
        return $this->getId();
51
    }
52
53
    /**
54
     * @param string $orderNumber
55
     * @return $this
56
     */
57
    public function setOrderNumber($orderNumber)
58
    {
59
        return $this->setId($orderNumber);
60
    }
61
62
    /**
63
     * @return string
64
     * @internal
65
     */
66
    protected function getPath()
67
    {
68
        return (string)$this->getEndpoint() . '/order-number=' . urlencode($this->getId()) . $this->getParamString();
69
    }
70
}
71

src/Core/Request/Orders/OrderUpdateByOrderNumberRequest.php 1 location

@@ 20-71 (lines=52) @@
17
 * @method Order mapResponse(ApiResponseInterface $response)
18
 * @method Order mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
19
 */
20
class OrderUpdateByOrderNumberRequest extends AbstractUpdateRequest
21
{
22
    protected $resultClass = Order::class;
23
24
    /**
25
     * @param string $orderNumber
26
     * @param string $version
27
     * @param array $actions
28
     * @param Context $context
29
     */
30
    public function __construct($orderNumber, $version, array $actions = [], Context $context = null)
31
    {
32
        parent::__construct(OrdersEndpoint::endpoint(), $orderNumber, $version, $actions, $context);
33
    }
34
35
    /**
36
     * @param string $orderNumber
37
     * @param int $version
38
     * @param Context $context
39
     * @return static
40
     */
41
    public static function ofOrderNumberAndVersion($orderNumber, $version, Context $context = null)
42
    {
43
        return new static($orderNumber, $version, [], $context);
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getOrderNumber()
50
    {
51
        return $this->getId();
52
    }
53
54
    /**
55
     * @param string $orderNumber
56
     * @return $this
57
     */
58
    public function setOrderNumber($orderNumber)
59
    {
60
        return $this->setId($orderNumber);
61
    }
62
63
    /**
64
     * @return string
65
     * @internal
66
     */
67
    protected function getPath()
68
    {
69
        return (string)$this->getEndpoint() . '/order-number=' . urlencode($this->getId()) . $this->getParamString();
70
    }
71
}
72