LeagueWrap\Api\AbstractApi::extractId PHP Method

extractId() protected method

Attempts to extract an ID from the object/value given
protected extractId ( LeagueWrap\Dto\Summoner | integer $identity ) : integer
$identity LeagueWrap\Dto\Summoner | integer
return integer
    protected function extractId($identity)
    {
        if ($identity instanceof Summoner) {
            return $identity->id;
        } elseif (filter_var($identity, FILTER_VALIDATE_INT) !== false) {
            return $identity;
        } else {
            throw new InvalidIdentityException("The identity '{$identity}' is not valid.");
        }
    }