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

LastTradedPriceResponse   A

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
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
}