Passed
Push — master ( 8e7304...5050b5 )
by Vladislav
05:53 queued 14s
created

OrderBookPriceAbstract   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPrice() 0 3 1
A __construct() 0 5 1
A getSize() 0 3 1
A setPrice() 0 4 1
A setSize() 0 4 1
1
<?php
2
namespace Carpenstar\ByBitAPI\WebSockets\Channels\Spot\PublicChannels\OrderBook\Entities;
3
4
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
5
6
class OrderBookPriceAbstract extends AbstractResponse
7
{
8
    /**
9
     * @var float $price
10
     */
11
    private float $price;
12
13
    /**
14
     * @var float $size
15
     */
16
    private float $size;
17
18
    public function __construct(array $data)
19
    {
20
        $this
21
            ->setPrice($data[0])
22
            ->setSize($data[1]);
23
    }
24
25
    /**
26
     * @param float $price
27
     * @return self
28
     */
29
    private function setPrice(float $price): self
30
    {
31
        $this->price = $price;
32
        return $this;
33
    }
34
35
    /**
36
     * @return float
37
     */
38
    public function getPrice(): float
39
    {
40
        return $this->price;
41
    }
42
43
    /**
44
     * @param float $size
45
     * @return self
46
     */
47
    private function setSize(float $size): self
48
    {
49
        $this->size = $size;
50
        return $this;
51
    }
52
53
    /**
54
     * @return float
55
     */
56
    public function getSize(): float
57
    {
58
        return $this->size;
59
    }
60
}