src/Client.php
private function _locationsByIdAndRank(int $id, $rank)
    {
        $curlClient = curl_init(
            self::BASE_URL .
            self::LOCATIONS_URL .
            '/' .
            $id .
            '/rankings/' .
            $rank
        );
        curl_setopt($curlClient, CURLOPT_HTTPHEADER, $this->_curlHeader);
        curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, true);
        $results = json_decode(curl_exec($curlClient), true);
        $items   = [];
        foreach ($results['items'] as $result) {
            if ($rank === RankingId::CLANS) {
                $items[] = Clan::create($result);
            } else {
                $items[] = Player::create($result);
            }
        }
        return $items;
    }
private function _locationsByIdAndRank(int $id, $rank)
    {
        $curlClient = curl_init(
            self::BASE_URL .
            self::LOCATIONS_URL .
            '/' .
            $id .
            '/rankings/' .
            $rank
        );
        curl_setopt($curlClient, CURLOPT_HTTPHEADER, $this->_curlHeader);
        curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, true);
        $results = json_decode(curl_exec($curlClient), true);
        $items   = [];
        foreach ($results['items'] as $result) {
            if ($rank === RankingId::CLANS) {
                $items[] = Clan::create($result);
            } else {
                $items[] = Player::create($result);
            }
        }
        return $items;
    }
private function _locationsByIdAndRank ( int $ id , $ rank ) { $ curlClient = curl_init ( self :: BASE_URL . self :: LOCATIONS_URL . '/' . $ id . '/rankings/' . $ rank ) ; curl_setopt ( $ curlClient , CURLOPT_HTTPHEADER , $ this -> _curlHeader ) ; curl_setopt ( $ curlClient , CURLOPT_RETURNTRANSFER , true ) ; $ results = json_decode ( curl_exec ( $ curlClient ) , true ) ; $ items = [ ] ; foreach ( $ results [ 'items' ] as $ result ) { if ( $ rank === RankingId :: CLANS ) { $ items [ ] = Clan :: create ( $ result ) ; } else { $ items [ ] = Player :: create ( $ result ) ; } } return $ items ; }
Based on a Location, retrieve the local rankings
@param int              $id   the unique identifier of the location
@param string|RankingId $rank the kind of ranking you want to retrieve.
Based on Clans and based on players is supported at the moment.
@return The clans/player who are located at the location id
Based on a Location retrieve the local rankings