kevinohashi / php-riot-api

PHP Wrapper for Riot Games API
MIT License
75 stars 40 forks source link

Correct casing for summonername #56

Open Krayt1x opened 8 years ago

Krayt1x commented 8 years ago

This is mainly me learning how to do pull requests, but i wanted to get the correct casing on a username.

kevinohashi commented 8 years ago

I'm confused what this is trying to do or add to the library? It looks like you created a function to get a summoner by name passing in a name?

Krayt1x commented 8 years ago

yeah forget what im trying to do there, i see its already implements in the getSummoner call.

what it did do was correct the casing on a summoner name

example being you would put in username and get back USerNaMe or what ever casing they have.

kevinohashi commented 8 years ago

Ah I see. That functionality exists in

    //Returns summoner info given summoner id.
    public function getSummoner($id,$option=null){
        $call = 'summoner/' . $id;
        switch ($option) {
            case 'masteries':
                $call .= '/masteries';
                break;
            case 'runes':
                $call .= '/runes';
                break;
            case 'name':
                $call .= '/name';
                break;
            default:
                //do nothing
                break;
        }
        //add API URL to the call
        $call = self::API_URL_1_4 . $call;
        return $this->request($call);
    }

if you pass in optional parameter 'name'

if you pass summoner id 19008487 with name optional param, you get back:

{"19008487": "PewPewLasers"}
Krayt1x commented 8 years ago

hey, i made the other post before i saw this but i seem to be getting the same string vs array issue again with this query as well.