MergedOrderBookPriceItemResponse::setPrice()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\MarketData\MergedOrderBook\Response;
4
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Spot\MarketData\MergedOrderBook\Interfaces\IMergedOrderBookPriceResponseInterface;
7
8
class MergedOrderBookPriceItemResponse extends AbstractResponse implements IMergedOrderBookPriceResponseInterface
9
{
10
    /**
11
     * Price position value
12
     * @var float
13
     */
14
    private float $price;
15
16
    /**
17
     * Quantity position value
18
     * @var float
19
     */
20
    private float $quantity;
21
22
    /**
23
     * @param array $data
24
     */
25
    public function __construct(array $data)
26
    {
27
        $this
28
            ->setPrice($data[0])
29
            ->setQuantity($data[1]);
30
    }
31
32
    /**
33
     * @param float $price
34
     * @return $this
35
     */
36
    private function setPrice(float $price): self
37
    {
38
        $this->price = $price;
39
        return $this;
40
    }
41
42
    /**
43
     * @return float
44
     */
45
    public function getPrice(): float
46
    {
47
        return $this->price;
48
    }
49
50
    /**
51
     * @param float $quantity
52
     * @return MergedOrderBookPriceItemResponse
53
     */
54
    private function setQuantity(float $quantity): self
55
    {
56
        $this->quantity = $quantity;
57
        return $this;
58
    }
59
60
    /**
61
     * @return float
62
     */
63
    public function getQuantity(): float
64
    {
65
        return $this->quantity;
66
    }
67
}
68