PHP / JSON数组 - 使用Riot Games API为foreach()提供的参数无效

I am returning to an old project that I created using Riot Games API but had to update the wrapper I was using (https://github.com/kevinohashi/php-riot-api) - my test enviornment is http://sutsurikeru.com/fallingmoon/ - all errors are outputted here.

Everything worked a treat befre updating the wrapper, but this was some time ago and Riot's API has changed since as well.

Firstly I get the following:

Warning: Invalid argument supplied for foreach() in /home/sites
/sutsurikeru.com/public_html/fallingmoon/index.php on line 50 

which relates to following:

//sorts by number of league points
foreach($array as $key => $league){
    usort($array[$key]['entries'], function($a,$b){
        return $a['leaguePoints'] - $b['leaguePoints'];
    });
}

If there is something I have overlooked, any advice is greatly appreciated!

Full pastebin of my script: http://pastebin.com/9JzNSvcU

I got it working by adding ['0'] after $array[$key]

foreach($array as $key => $league){
    usort($array[$key]['0']['entries'], function($a,$b){
        return $b['leaguePoints'] - $a['leaguePoints'];
    });

}