src/Service/UserService.php
public function getRecentTracks(string $username, ?RangeFilter $filter = null, $extended = false, $limit = 50, int $page = 1): array
    {
        $query = null !== $filter ? $filter->getQuery('from', 'to') : [];
        $query = array_merge($query, [
            'user'     => $username,
            'limit'    => $limit,
            'page'     => $page,
            'extended' => (int) $extended,
        ]);

        $response = $this->client->unsignedCall('user.getRecentTracks', $query);

        if (!isset($response['recenttracks']['track'])) {
            return [];
        }

        return ApiHelper::mapList(
            static function ($data) {
                return Song::fromApi($data);
            },
            $response['recenttracks']['track']
        );
    }
public function getRecentTracks(string $username, ?RangeFilter $filter = null, $extended = false, $limit = 50, int $page = 1): array
    {
        $query = null !== $filter ? $filter->getQuery('from', 'to') : [];
        $query = array_merge($query, [
            'user'     => $username,
            'limit'    => $limit,
            'page'     => $page,
            'extended' => (int) $extended,
        ]);

        $response = $this->client->unsignedCall('user.getRecentTracks', $query);

        if (!isset($response['recenttracks']['track'])) {
            return [];
        }

        return ApiHelper::mapList(
            static function ($data) {
                return Song::fromApi($data);
            },
            $response['recenttracks']['track']
        );
    }
{@inheritdoc}