LastTradedPriceResponse   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setPrice() 0 4 1
A setSymbol() 0 4 1
A getPrice() 0 3 1
A getSymbol() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\MarketData\LastTradedPrice\Response;
4
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Spot\MarketData\LastTradedPrice\Interfaces\ILastTradedPriceResponseInterface;
7
8
class LastTradedPriceResponse extends AbstractResponse implements ILastTradedPriceResponseInterface
9
{
10
    /**
11
     * Name of the trading pair
12
     * @var string $symbol
13
     */
14
    private string $symbol;
15
16
    /**
17
     * Last traded price
18
     * @var float
19
     */
20
    private float $price;
21
22
    /**
23
     * @param array $data
24
     */
25
    public function __construct(array $data)
26
    {
27
        $this
28
            ->setSymbol($data['symbol'])
29
            ->setPrice($data['price']);
30
    }
31
32
    /**
33
     * @param string $symbol
34
     * @return LastTradedPriceResponse
35
     */
36
    private function setSymbol(string $symbol): self
37
    {
38
        $this->symbol = $symbol;
39
        return $this;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getSymbol(): string
46
    {
47
        return $this->symbol;
48
    }
49
50
    /**
51
     * @param float $price
52
     * @return LastTradedPriceResponse
53
     */
54
    private function setPrice(float $price): self
55
    {
56
        $this->price = $price;
57
        return $this;
58
    }
59
60
    /**
61
     * @return float
62
     */
63
    public function getPrice(): float
64
    {
65
        return $this->price;
66
    }
67
}
68