LeagueWrap\Api\AbstractApi::attachResponses PHP Method

attachResponses() protected method

Attempts to attach all the responses to the correct summoner.
protected attachResponses ( array | LeagueWrap\Dto\Summoner $identities, mixed $responses, string $key ) : boolean
$identities array | LeagueWrap\Dto\Summoner
$responses mixed
$key string
return boolean
    protected function attachResponses($identities, $responses, $key)
    {
        if (is_array($identities)) {
            foreach ($identities as $identity) {
                if ($identity instanceof Summoner) {
                    $id = $identity->id;
                    if (isset($responses[$id])) {
                        $response = $responses[$id];
                        $this->attachResponse($identity, $response, $key);
                    } else {
                        // we did not get a response for this id, attach null
                        $this->attachResponse($identity, null, $key);
                    }
                }
            }
        } else {
            $identity = $identities;
            if ($identity instanceof Summoner) {
                $id = $identity->id;
                if (isset($responses[$id])) {
                    $response = $responses[$id];
                    $this->attachResponse($identity, $response, $key);
                } else {
                    // we did not get a response for this id, attach null
                    $this->attachResponse($identity, null, $key);
                }
            }
        }
        return true;
    }