[COMPOSER] Added predis/predis and updated packages
This commit is contained in:
66
vendor/php-http/guzzle6-adapter/CHANGELOG.md
vendored
Normal file
66
vendor/php-http/guzzle6-adapter/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# Change Log
|
||||
|
||||
|
||||
## 1.1.1 - 2016-05-10
|
||||
|
||||
### Fixed
|
||||
|
||||
- Adapter can again be instantiated without a guzzle client.
|
||||
|
||||
## 1.1.0 - 2016-05-09
|
||||
|
||||
### Added
|
||||
|
||||
- Factory method Client::createWithConfig to create an adapter with custom
|
||||
configuration for the underlying guzzle client.
|
||||
|
||||
|
||||
## 1.0.0 - 2016-01-26
|
||||
|
||||
|
||||
## 0.4.1 - 2016-01-13
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated integration tests
|
||||
|
||||
### Removed
|
||||
|
||||
- Client common dependency
|
||||
|
||||
|
||||
## 0.4.0 - 2016-01-12
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated package files
|
||||
- Updated HTTPlug to RC1
|
||||
|
||||
|
||||
## 0.2.1 - 2015-12-17
|
||||
|
||||
### Added
|
||||
|
||||
- Puli configuration and bindings
|
||||
|
||||
### Changed
|
||||
|
||||
- Guzzle setup conforms to HTTPlug requirement now: Minimal functionality in client
|
||||
|
||||
|
||||
## 0.2.0 - 2015-12-15
|
||||
|
||||
### Added
|
||||
|
||||
- Async client capabalities
|
||||
|
||||
### Changed
|
||||
|
||||
- HTTPlug instead of HTTP Adapter
|
||||
|
||||
|
||||
## 0.1.0 - 2015-06-12
|
||||
|
||||
### Added
|
||||
|
||||
- Initial release
|
20
vendor/php-http/guzzle6-adapter/LICENSE
vendored
Normal file
20
vendor/php-http/guzzle6-adapter/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2014-2015 Eric GELOEN <geloen.eric@gmail.com>
|
||||
Copyright (c) 2015-2016 PHP HTTP Team <team@php-http.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
59
vendor/php-http/guzzle6-adapter/README.md
vendored
Normal file
59
vendor/php-http/guzzle6-adapter/README.md
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
# Guzzle 6 HTTP Adapter
|
||||
|
||||
[](https://github.com/php-http/guzzle6-adapter/releases)
|
||||
[](LICENSE)
|
||||
[](https://travis-ci.org/php-http/guzzle6-adapter)
|
||||
[](https://scrutinizer-ci.com/g/php-http/guzzle6-adapter)
|
||||
[](https://scrutinizer-ci.com/g/php-http/guzzle6-adapter)
|
||||
[](https://packagist.org/packages/php-http/guzzle6-adapter)
|
||||
|
||||
**Guzzle 6 HTTP Adapter.**
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
Via Composer
|
||||
|
||||
``` bash
|
||||
$ composer require php-http/guzzle6-adapter
|
||||
```
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Please see the [official documentation](http://docs.php-http.org/en/latest/clients/guzzle6-adapter.html).
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
First launch the http server:
|
||||
|
||||
```bash
|
||||
$ ./vendor/bin/http_test_server > /dev/null 2>&1 &
|
||||
```
|
||||
|
||||
Then the test suite:
|
||||
|
||||
``` bash
|
||||
$ composer test
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
Thanks to [David de Boer](https://github.com/ddeboer) for implementing this adapter.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE) for more information.
|
49
vendor/php-http/guzzle6-adapter/composer.json
vendored
Normal file
49
vendor/php-http/guzzle6-adapter/composer.json
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "php-http/guzzle6-adapter",
|
||||
"description": "Guzzle 6 HTTP Adapter",
|
||||
"license": "MIT",
|
||||
"keywords": ["guzzle", "http"],
|
||||
"homepage": "http://httplug.io",
|
||||
"authors": [
|
||||
{
|
||||
"name": "David de Boer",
|
||||
"email": "david@ddeboer.nl"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.0",
|
||||
"php-http/httplug": "^1.0",
|
||||
"guzzlehttp/guzzle": "^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"php-http/adapter-integration-tests": "^0.4"
|
||||
},
|
||||
"provide": {
|
||||
"php-http/client-implementation": "1.0",
|
||||
"php-http/async-client-implementation": "1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Adapter\\Guzzle6\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Http\\Adapter\\Guzzle6\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpunit",
|
||||
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
16
vendor/php-http/guzzle6-adapter/puli.json
vendored
Normal file
16
vendor/php-http/guzzle6-adapter/puli.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"name": "php-http/guzzle6-adapter",
|
||||
"bindings": {
|
||||
"04b5a002-71a8-473d-a8df-75671551b84a": {
|
||||
"_class": "Puli\\Discovery\\Binding\\ClassBinding",
|
||||
"class": "Http\\Adapter\\Guzzle6\\Client",
|
||||
"type": "Http\\Client\\HttpClient"
|
||||
},
|
||||
"9c856476-7f6b-43df-a740-15420a5f839c": {
|
||||
"_class": "Puli\\Discovery\\Binding\\ClassBinding",
|
||||
"class": "Http\\Adapter\\Guzzle6\\Client",
|
||||
"type": "Http\\Client\\HttpAsyncClient"
|
||||
}
|
||||
}
|
||||
}
|
84
vendor/php-http/guzzle6-adapter/src/Client.php
vendored
Normal file
84
vendor/php-http/guzzle6-adapter/src/Client.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Adapter\Guzzle6;
|
||||
|
||||
use GuzzleHttp\Client as GuzzleClient;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Middleware;
|
||||
use Http\Client\HttpAsyncClient;
|
||||
use Http\Client\HttpClient;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* HTTP Adapter for Guzzle 6.
|
||||
*
|
||||
* @author David de Boer <david@ddeboer.nl>
|
||||
*/
|
||||
class Client implements HttpClient, HttpAsyncClient
|
||||
{
|
||||
/**
|
||||
* @var ClientInterface
|
||||
*/
|
||||
private $client;
|
||||
|
||||
/**
|
||||
* @param ClientInterface|null $client
|
||||
*/
|
||||
public function __construct(ClientInterface $client = null)
|
||||
{
|
||||
if (!$client) {
|
||||
$client = static::buildClient();
|
||||
}
|
||||
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to create the guzzle 6 adapter with custom configuration for guzzle.
|
||||
*
|
||||
* @param array $config Configuration to create guzzle with.
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
public static function createWithConfig(array $config)
|
||||
{
|
||||
return new self(static::buildClient($config));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sendRequest(RequestInterface $request)
|
||||
{
|
||||
$promise = $this->sendAsyncRequest($request);
|
||||
|
||||
return $promise->wait();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sendAsyncRequest(RequestInterface $request)
|
||||
{
|
||||
$promise = $this->client->sendAsync($request);
|
||||
|
||||
return new Promise($promise, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the guzzle client instance.
|
||||
*
|
||||
* @param array $config Additional configuration
|
||||
*
|
||||
* @return GuzzleClient
|
||||
*/
|
||||
private static function buildClient(array $config = [])
|
||||
{
|
||||
$handlerStack = new HandlerStack(\GuzzleHttp\choose_handler());
|
||||
$handlerStack->push(Middleware::prepareBody(), 'prepare_body');
|
||||
$config = array_merge(['handler' => $handlerStack], $config);
|
||||
|
||||
return new GuzzleClient($config);
|
||||
}
|
||||
}
|
140
vendor/php-http/guzzle6-adapter/src/Promise.php
vendored
Normal file
140
vendor/php-http/guzzle6-adapter/src/Promise.php
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Adapter\Guzzle6;
|
||||
|
||||
use GuzzleHttp\Exception as GuzzleExceptions;
|
||||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use Http\Client\Exception as HttplugException;
|
||||
use Http\Promise\Promise as HttpPromise;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Wrapper around Guzzle promises.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
class Promise implements HttpPromise
|
||||
{
|
||||
/**
|
||||
* @var PromiseInterface
|
||||
*/
|
||||
private $promise;
|
||||
|
||||
/**
|
||||
* @var string State of the promise
|
||||
*/
|
||||
private $state;
|
||||
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @var HttplugException
|
||||
*/
|
||||
private $exception;
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @param PromiseInterface $promise
|
||||
* @param RequestInterface $request
|
||||
*/
|
||||
public function __construct(PromiseInterface $promise, RequestInterface $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->state = self::PENDING;
|
||||
$this->promise = $promise->then(function ($response) {
|
||||
$this->response = $response;
|
||||
$this->state = self::FULFILLED;
|
||||
|
||||
return $response;
|
||||
}, function ($reason) use ($request) {
|
||||
$this->state = self::REJECTED;
|
||||
|
||||
if ($reason instanceof HttplugException) {
|
||||
$this->exception = $reason;
|
||||
} elseif ($reason instanceof GuzzleExceptions\GuzzleException) {
|
||||
$this->exception = $this->handleException($reason, $request);
|
||||
} elseif ($reason instanceof \Exception) {
|
||||
$this->exception = new \RuntimeException('Invalid exception returned from Guzzle6', 0, $reason);
|
||||
} else {
|
||||
$this->exception = new \UnexpectedValueException('Reason returned from Guzzle6 must be an Exception', 0, $reason);
|
||||
}
|
||||
|
||||
throw $this->exception;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function then(callable $onFulfilled = null, callable $onRejected = null)
|
||||
{
|
||||
return new static($this->promise->then($onFulfilled, $onRejected), $this->request);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function wait($unwrap = true)
|
||||
{
|
||||
$this->promise->wait(false);
|
||||
|
||||
if ($unwrap) {
|
||||
if ($this->getState() == self::REJECTED) {
|
||||
throw $this->exception;
|
||||
}
|
||||
|
||||
return $this->response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Guzzle exception into an Httplug exception.
|
||||
*
|
||||
* @param GuzzleExceptions\GuzzleException $exception
|
||||
* @param RequestInterface $request
|
||||
*
|
||||
* @return HttplugException
|
||||
*/
|
||||
private function handleException(GuzzleExceptions\GuzzleException $exception, RequestInterface $request)
|
||||
{
|
||||
if ($exception instanceof GuzzleExceptions\SeekException) {
|
||||
return new HttplugException\RequestException($exception->getMessage(), $request, $exception);
|
||||
}
|
||||
|
||||
if ($exception instanceof GuzzleExceptions\ConnectException) {
|
||||
return new HttplugException\NetworkException($exception->getMessage(), $exception->getRequest(), $exception);
|
||||
}
|
||||
|
||||
if ($exception instanceof GuzzleExceptions\RequestException) {
|
||||
// Make sure we have a response for the HttpException
|
||||
if ($exception->hasResponse()) {
|
||||
return new HttplugException\HttpException(
|
||||
$exception->getMessage(),
|
||||
$exception->getRequest(),
|
||||
$exception->getResponse(),
|
||||
$exception
|
||||
);
|
||||
}
|
||||
|
||||
return new HttplugException\RequestException($exception->getMessage(), $exception->getRequest(), $exception);
|
||||
}
|
||||
|
||||
return new HttplugException\TransferException($exception->getMessage(), 0, $exception);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user