public static function _apply_user_agent($value, array &$args, HandlerList $list) { if (!is_array($value)) { $value = [$value]; } $value = array_map('strval', $value); array_unshift($value, 'aws-sdk-php/' . Sdk::VERSION); $args['ua_append'] = $value; $list->appendBuild(static function (callable $handler) use($value) { return function (CommandInterface $command, RequestInterface $request) use($handler, $value) { return $handler($command, $request->withHeader('User-Agent', implode(' ', array_merge($value, $request->getHeader('User-Agent'))))); }; }); }