Total Complexity | 7 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class PublicTradeResponse extends AbstractResponse |
||
11 | { |
||
12 | |||
13 | private string $topic; |
||
14 | |||
15 | private string $type; |
||
16 | |||
17 | private \DateTime $createdAt; |
||
18 | |||
19 | private ICollectionInterface $data; |
||
20 | |||
21 | |||
22 | public function __construct(array $data) |
||
23 | { |
||
24 | $collection = new EntityCollection(); |
||
25 | |||
26 | $this->topic = $data['topic']; |
||
27 | $this->type = $data['type']; |
||
28 | $this->createdAt = DateTimeHelper::makeFromTimestamp($data['ts']); |
||
29 | |||
30 | if (!empty($data['data'])) { |
||
31 | if (!empty($data['data'])) { |
||
32 | array_map(function ($item) use ($collection) { |
||
33 | $collection->push(ResponseDtoBuilder::make(PublicTradeResponseItem::class, $item)); |
||
34 | }, $data['data']); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | $this->data = $collection; |
||
39 | } |
||
40 | |||
41 | public function getTopic(): string |
||
44 | } |
||
45 | |||
46 | public function getType(): string |
||
47 | { |
||
48 | return $this->type; |
||
49 | } |
||
50 | |||
51 | public function getCreatedAt(): \DateTime |
||
54 | } |
||
55 | |||
56 | public function getData(): array |
||
61 |