play-code-live/vkplay-live-sdk

View on GitHub
src/Response/OnlineChannelsResponse.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace PlayCode\VKPlayLiveSDK\Response;

use PlayCode\VKPlayLiveSDK\DTO\ChannelDTO;

class OnlineChannelsResponse extends JsonResponse
{
    /** @var ChannelDTO[] */
    public readonly array $channels;

    protected function buildFromBody(array $data): void
    {
        $this->channels = array_map(fn($channel) => ChannelDTO::fromArray($channel), $data['data']['channels']);
    }
}