Passed
Push — master ( 7a134a...be08d2 )
by Vladislav
02:35 queued 13s
created

LastTradedPriceResponse::getPrice()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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