Mailgun\Connection\RestClient::send PHP Метод

send() защищенный Метод

protected send ( string $method, string $uri, mixed $body = null, array $files = [], array $headers = [] ) : stdClass
$method string
$uri string
$body mixed
$files array
$headers array
Результат stdClass
    protected function send($method, $uri, $body = null, $files = [], array $headers = [])
    {
        $headers['User-Agent'] = Api::SDK_USER_AGENT . '/' . Api::SDK_VERSION;
        $headers['Authorization'] = 'Basic ' . base64_encode(sprintf('%s:%s', Api::API_USER, $this->apiKey));
        if (!empty($files)) {
            $builder = new MultipartStreamBuilder();
            foreach ($files as $file) {
                $builder->addResource($file['name'], $file['contents'], $file);
            }
            $body = $builder->build();
            $headers['Content-Type'] = 'multipart/form-data; boundary=' . $builder->getBoundary();
        } elseif (is_array($body)) {
            $body = http_build_query($body);
            $headers['Content-Type'] = 'application/x-www-form-urlencoded';
        }
        $request = MessageFactoryDiscovery::find()->createRequest($method, $this->getApiUrl($uri), $headers, $body);
        $response = $this->getHttpClient()->sendRequest($request);
        return $this->responseHandler($response);
    }