php-riot-api icon indicating copy to clipboard operation
php-riot-api copied to clipboard

Correct casing for summonername

Open Krayt1x opened this issue 9 years ago • 4 comments

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

Krayt1x avatar Jan 02 '16 06:01 Krayt1x

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?

kevinohashi avatar Jan 02 '16 06:01 kevinohashi

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.

Krayt1x avatar Jan 02 '16 06:01 Krayt1x

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"}

kevinohashi avatar Jan 02 '16 06:01 kevinohashi

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.

Krayt1x avatar Jan 02 '16 07:01 Krayt1x