dolejska-daniel / riot-api

Riot League of Legends & DataDragon API wrappers for PHP7 and PHP8.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with getMatch endpoint

elreco opened this issue · comments

Hi!

Sometimes when I try to retrieve a match with the getMatch function I got this error :

Argument 1 passed to RiotAPI\LeagueAPI\Objects\ApiObject::__construct() must be of the type array, boolean given, called in E:\Programmes\laragon\www\probuilds\vendor\dolejska-daniel\riot-api\src\LeagueAPI\LeagueAPI.php on line 1995

The $result variable is false in the getStaticChampion function

My endpoint is : "/lol/match/v4/matches/4476606456"

Do you know why?

Thank you! :)

That could happen when the request fails or rather doesnt return anything.. Is the ID and region correctly set?

Here is my init setting :

$this->riot = new LeagueAPI([
        LeagueAPI::SET_KEY              => env('RIOT_API_KEY'),
        LeagueAPI::SET_TOURNAMENT_KEY   => "",
        LeagueAPI::SET_REGION           => Region::EUROPE_WEST,
        LeagueAPI::SET_VERIFY_SSL       => false,
        LeagueAPI::SET_DATADRAGON_INIT  => true,
        LeagueAPI::SET_STATICDATA_LINKING => true,
        LeagueAPI::SET_INTERIM          => true,
        LeagueAPI::SET_CACHE_RATELIMIT  => true,
        LeagueAPI::SET_CACHE_CALLS      => true,
        LeagueAPI::SET_CACHE_CALLS_LENGTH=> 9999
]);

and I get the match ID using getMatchlistByAccount.

the result :

9ca7dc37a1f7de752b6277ba805dfe45

Could you try without LeagueAPI::SET_STATICDATA_LINKING?

If it works try pulling latest version from master, it should be fixed there 😺

It works with the latest version from master! thank you

Happy to help!