Test Failed
Pull Request — master (#13)
by Vladislav
09:26 queued 01:13
created

AllAssetInfoResponse::getAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Spot\LeverageToken\AllAssetInfo\Response;
3
4
use Carpenstar\ByBitAPI\Core\Builders\ResponseDtoBuilder;
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Core\Objects\Collection\EntityCollection;
7
use Carpenstar\ByBitAPI\Spot\LeverageToken\AllAssetInfo\Interfaces\IAllAssetInfoResponseInterface;
8
use Carpenstar\ByBitAPI\Spot\LeverageToken\AllAssetInfo\Interfaces\IAllAssetInfoResponseItemInterface;
9
10
class AllAssetInfoResponse extends AbstractResponse implements IAllAssetInfoResponseInterface
11
{
12
13
    /** @var IAllAssetInfoResponseItemInterface $list */
14
    private EntityCollection $list;
15
16
    public function __construct(array $data)
17
    {
18
        $list = new EntityCollection();
19
20
        if (!empty($data['list'])) {
21
            array_map(function ($item) use ($list) {
22
                $list->push(ResponseDtoBuilder::make(AllAssetInfoResponseItem::class, $item));
23
            }, $data['list']);
24
        }
25
26
        $this->list = $list;
0 ignored issues
show
Documentation Bug introduced by
It seems like $list of type Carpenstar\ByBitAPI\Core...ection\EntityCollection is incompatible with the declared type Carpenstar\ByBitAPI\Spot...foResponseItemInterface of property $list.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
27
    }
28
29
    public function getAssets(): array
30
    {
31
        return $this->list->all();
32
    }
33
}