LeagueWrap\Api\Summoner::info PHP Method

info() public method

Gets the information about the user by the given identification. IDs must be of type integer, otherwise, numeric string values will be assumed to be names.
public info ( mixed $identities ) : LeagueWrap\Dto\Summoner
$identities mixed
return LeagueWrap\Dto\Summoner
    public function info($identities)
    {
        $ids = [];
        $names = [];
        if (is_array($identities)) {
            foreach ($identities as $identity) {
                if (gettype($identity) === 'integer') {
                    // it's the id
                    $ids[] = $identity;
                } else {
                    // the summoner name
                    $names[] = $identity;
                }
            }
        } else {
            if (gettype($identities) === 'integer') {
                // it's the id
                $ids[] = $identities;
            } else {
                // the summoner name
                $names[] = $identities;
            }
        }
        if (count($ids) > 0) {
            // it's the id
            $ids = $this->infoByIds($ids);
        }
        if (count($names) > 0) {
            // the summoner name
            $names = $this->infoByNames($names);
        }
        $summoners = $ids + $names;
        if (count($summoners) == 1) {
            return reset($summoners);
        } else {
            return $summoners;
        }
    }