Passed
Pull Request — master (#7)
by Vladislav
03:08
created

CancelOrderRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 77
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getOrderId() 0 3 1
A setOrderLinkId() 0 4 1
A setOrderCategory() 0 4 1
A __construct() 0 3 1
A getOrderLinkId() 0 3 1
A getOrderCategory() 0 3 1
A setOrderId() 0 4 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Spot\Trade\CancelOrder\Request;
3
4
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
5
6
class CancelOrderRequest extends AbstractParameters
7
{
8
    /**
9
     * Order ID. Required if not passing orderLinkId
10
     * @var int $orderId
11
     */
12
    protected ?int $orderId = null;
13
14
    /**
15
     * Unique user-set order ID. Required if not passing orderId
16
     * @var string $orderLinkId
17
     */
18
    protected ?string $orderLinkId = null;
19
20
    /**
21
     * Order category. 0:normal order by default; 1:TP/SL order, Required for TP/SL order.
22
     * @var int $orderCategory
23
     */
24
    protected int $orderCategory;
25
26
    public function __construct()
27
    {
28
        $this->setRequiredBetweenField('orderId', 'orderLinkId');
29
    }
30
31
    /**
32
     * @param int $orderId
33
     * @return CancelOrderRequest
34
     */
35
    public function setOrderId(?int $orderId): self
36
    {
37
        $this->orderId = $orderId;
38
        return $this;
39
    }
40
41
    /**
42
     * @return int
43
     */
44
    public function getOrderId(): ?int
45
    {
46
        return $this->orderId;
47
    }
48
49
    /**
50
     * @param string $orderLinkId
51
     * @return CancelOrderRequest
52
     */
53
    public function setOrderLinkId(?string $orderLinkId): self
54
    {
55
        $this->orderLinkId = $orderLinkId;
56
        return $this;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getOrderLinkId(): ?string
63
    {
64
        return $this->orderLinkId;
65
    }
66
67
    /**
68
     * @param int $orderCategory
69
     * @return CancelOrderRequest
70
     */
71
    public function setOrderCategory(int $orderCategory): self
72
    {
73
        $this->orderCategory = $orderCategory;
74
        return $this;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getOrderCategory(): int
81
    {
82
        return $this->orderCategory;
83
    }
84
}