/** * Notifies the YooChoose API using Guzzle 6 asynchronously. * * @param array $events */ private function notifyGuzzle6(array $events) { $promise = $this->guzzle->requestAsync('POST', $this->getNotificationEndpoint(), array('json' => array('transaction' => null, 'events' => $events), 'auth' => array($this->options['customer-id'], $this->options['license-key']))); if (isset($this->logger)) { $this->logger->debug('Got asynchronously ' . $promise->getState() . ' from YooChoose notification POST'); } }
/** * Create an instance of SoapClientInterface asynchronously. * * @param ClientInterface $client A Guzzle HTTP client. * @param mixed $wsdl URI of the WSDL file or NULL if working in non-WSDL mode. * @param array $options Supported options: location, uri, style, use, soap_version, encoding, * exceptions, classmap, typemap, and feature. HTTP related options should * be configured against $client, e.g., authentication, proxy, user agent, * and connection timeout etc. * @return SoapClientInterface */ public function create(ClientInterface $client, $wsdl, array $options = []) { if (null === $wsdl) { $httpBindingPromise = new FulfilledPromise(new HttpBinding(new Interpreter($wsdl, $options), new RequestBuilder())); } else { $httpBindingPromise = $client->requestAsync('GET', $wsdl)->then(function (ResponseInterface $response) use($options) { $wsdl = $response->getBody()->__toString(); $interpreter = new Interpreter('data://text/plain;base64,' . base64_encode($wsdl), $options); return new HttpBinding($interpreter, new RequestBuilder()); }); } return new SoapClient($client, $httpBindingPromise); }