|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Carpenstar\ByBitAPI\WebSockets\Channels\Spot\PublicChannels\Bookticker\Entities; |
|
4
|
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
|
6
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse; |
|
7
|
|
|
use Carpenstar\ByBitAPI\Core\Builders\ResponseDtoBuilder; |
|
8
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\Collection\EntityCollection; |
|
9
|
|
|
use Carpenstar\ByBitAPI\WebSockets\Channels\Spot\PublicChannels\OrderBook\Entities\OrderBookPriceAbstract; |
|
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class BooktickerResponse extends AbstractResponse |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* Topic name |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
private string $topic; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* The timestamp (ms) that message is sent out |
|
21
|
|
|
* @var \DateTime $requestTimestamp |
|
22
|
|
|
*/ |
|
23
|
|
|
private \DateTime $requestTimestamp; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Data type. snapshot |
|
27
|
|
|
* @var string $type |
|
28
|
|
|
*/ |
|
29
|
|
|
private string $type; |
|
30
|
|
|
|
|
31
|
|
|
private EntityCollection $data; |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
public function __construct(array $data) |
|
35
|
|
|
{ |
|
36
|
|
|
$collection = new EntityCollection(); |
|
37
|
|
|
|
|
38
|
|
|
$this->topic = $data['topic']; |
|
39
|
|
|
$this->requestTimestamp = DateTimeHelper::makeFromTimestamp($data['ts']); |
|
40
|
|
|
$this->type = $data['type']; |
|
41
|
|
|
|
|
42
|
|
|
if (!empty($data['data'])) { |
|
43
|
|
|
|
|
44
|
|
|
$data['data'] = array_is_list($data['data']) ? $data['data'] : [$data['data']]; |
|
|
|
|
|
|
45
|
|
|
|
|
46
|
|
|
array_map(function ($item) use ($collection) { |
|
47
|
|
|
$collection->push(ResponseDtoBuilder::make(BoocktickerResponseItem::class, $item)); |
|
48
|
|
|
}, $data['data']); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
$this->data = $collection; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return string |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getTopic(): string |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->topic; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return \DateTime |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getRequestTimestamp(): \DateTime |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->requestTimestamp; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return string |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getType(): string |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->type; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function getData(): array |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->data->all(); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths