public function getClient($client, $profile = null, array $args = [])
{
if (!is_string($client)) {
throw new \InvalidArgumentException('Client parameter must be a string');
}
if (getenv('AWS_UNSET_PROFILE')) {
$profile = '';
}
if (!is_null($profile) && !is_string($profile)) {
throw new \InvalidArgumentException('Profile parameter must be a string');
}
$cacheKey = md5(json_encode([$client, $profile, $args]));
if (!isset($this->clients[$cacheKey])) {
if ($profile && !isset($args['credentials'])) {
$args['credentials'] = $this->credentialProvider->getCredentialsForProfile($profile);
}
$this->printDebug($client, $profile);
$this->clients[$cacheKey] = $this->getSdk()->createClient($client, $args);
}
return $this->clients[$cacheKey];
}