forked from GNUsocial/gnu-social
[COMPOSER] Added predis/predis and updated packages
This commit is contained in:
committed by
Diogo Cordeiro
parent
0bb35d7e7f
commit
630a578e1d
12
vendor/php-http/httplug/src/Exception.php
vendored
Normal file
12
vendor/php-http/httplug/src/Exception.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client;
|
||||
|
||||
/**
|
||||
* Every HTTP Client related Exception must implement this interface.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
interface Exception
|
||||
{
|
||||
}
|
74
vendor/php-http/httplug/src/Exception/HttpException.php
vendored
Normal file
74
vendor/php-http/httplug/src/Exception/HttpException.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client\Exception;
|
||||
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Thrown when a response was received but the request itself failed.
|
||||
*
|
||||
* In addition to the request, this exception always provides access to the response object.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
class HttpException extends RequestException
|
||||
{
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param RequestInterface $request
|
||||
* @param ResponseInterface $response
|
||||
* @param \Exception|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
$message,
|
||||
RequestInterface $request,
|
||||
ResponseInterface $response,
|
||||
\Exception $previous = null
|
||||
) {
|
||||
parent::__construct($message, $request, $previous);
|
||||
|
||||
$this->response = $response;
|
||||
$this->code = $response->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the response.
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to create a new exception with a normalized error message.
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param ResponseInterface $response
|
||||
* @param \Exception|null $previous
|
||||
*
|
||||
* @return HttpException
|
||||
*/
|
||||
public static function create(
|
||||
RequestInterface $request,
|
||||
ResponseInterface $response,
|
||||
\Exception $previous = null
|
||||
) {
|
||||
$message = sprintf(
|
||||
'[url] %s [http method] %s [status code] %s [reason phrase] %s',
|
||||
$request->getRequestTarget(),
|
||||
$request->getMethod(),
|
||||
$response->getStatusCode(),
|
||||
$response->getReasonPhrase()
|
||||
);
|
||||
|
||||
return new self($message, $request, $response, $previous);
|
||||
}
|
||||
}
|
14
vendor/php-http/httplug/src/Exception/NetworkException.php
vendored
Normal file
14
vendor/php-http/httplug/src/Exception/NetworkException.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when the request cannot be completed because of network issues.
|
||||
*
|
||||
* There is no response object as this exception is thrown when no response has been received.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
class NetworkException extends RequestException
|
||||
{
|
||||
}
|
43
vendor/php-http/httplug/src/Exception/RequestException.php
vendored
Normal file
43
vendor/php-http/httplug/src/Exception/RequestException.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client\Exception;
|
||||
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Exception for when a request failed, providing access to the failed request.
|
||||
*
|
||||
* This could be due to an invalid request, or one of the extending exceptions
|
||||
* for network errors or HTTP error responses.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
class RequestException extends TransferException
|
||||
{
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param RequestInterface $request
|
||||
* @param \Exception|null $previous
|
||||
*/
|
||||
public function __construct($message, RequestInterface $request, \Exception $previous = null)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
parent::__construct($message, 0, $previous);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the request.
|
||||
*
|
||||
* @return RequestInterface
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
14
vendor/php-http/httplug/src/Exception/TransferException.php
vendored
Normal file
14
vendor/php-http/httplug/src/Exception/TransferException.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client\Exception;
|
||||
|
||||
use Http\Client\Exception;
|
||||
|
||||
/**
|
||||
* Base exception for transfer related exceptions.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
class TransferException extends \RuntimeException implements Exception
|
||||
{
|
||||
}
|
27
vendor/php-http/httplug/src/HttpAsyncClient.php
vendored
Normal file
27
vendor/php-http/httplug/src/HttpAsyncClient.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client;
|
||||
|
||||
use Http\Promise\Promise;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Sends a PSR-7 Request in an asynchronous way by returning a Promise.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
interface HttpAsyncClient
|
||||
{
|
||||
/**
|
||||
* Sends a PSR-7 request in an asynchronous way.
|
||||
*
|
||||
* Exceptions related to processing the request are available from the returned Promise.
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
*
|
||||
* @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception.
|
||||
*
|
||||
* @throws \Exception If processing the request is impossible (eg. bad configuration).
|
||||
*/
|
||||
public function sendAsyncRequest(RequestInterface $request);
|
||||
}
|
28
vendor/php-http/httplug/src/HttpClient.php
vendored
Normal file
28
vendor/php-http/httplug/src/HttpClient.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client;
|
||||
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Sends a PSR-7 Request and returns a PSR-7 response.
|
||||
*
|
||||
* @author GeLo <geloen.eric@gmail.com>
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
* @author David Buchmann <mail@davidbu.ch>
|
||||
*/
|
||||
interface HttpClient
|
||||
{
|
||||
/**
|
||||
* Sends a PSR-7 request.
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*
|
||||
* @throws \Http\Client\Exception If an error happens during processing the request.
|
||||
* @throws \Exception If processing the request is impossible (eg. bad configuration).
|
||||
*/
|
||||
public function sendRequest(RequestInterface $request);
|
||||
}
|
57
vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php
vendored
Normal file
57
vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client\Promise;
|
||||
|
||||
use Http\Client\Exception;
|
||||
use Http\Promise\Promise;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
final class HttpFulfilledPromise implements Promise
|
||||
{
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*/
|
||||
public function __construct(ResponseInterface $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function then(callable $onFulfilled = null, callable $onRejected = null)
|
||||
{
|
||||
if (null === $onFulfilled) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
try {
|
||||
return new self($onFulfilled($this->response));
|
||||
} catch (Exception $e) {
|
||||
return new HttpRejectedPromise($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return Promise::FULFILLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function wait($unwrap = true)
|
||||
{
|
||||
if ($unwrap) {
|
||||
return $this->response;
|
||||
}
|
||||
}
|
||||
}
|
56
vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php
vendored
Normal file
56
vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Client\Promise;
|
||||
|
||||
use Http\Client\Exception;
|
||||
use Http\Promise\Promise;
|
||||
|
||||
final class HttpRejectedPromise implements Promise
|
||||
{
|
||||
/**
|
||||
* @var Exception
|
||||
*/
|
||||
private $exception;
|
||||
|
||||
/**
|
||||
* @param Exception $exception
|
||||
*/
|
||||
public function __construct(Exception $exception)
|
||||
{
|
||||
$this->exception = $exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function then(callable $onFulfilled = null, callable $onRejected = null)
|
||||
{
|
||||
if (null === $onRejected) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
try {
|
||||
return new HttpFulfilledPromise($onRejected($this->exception));
|
||||
} catch (Exception $e) {
|
||||
return new self($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return Promise::REJECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function wait($unwrap = true)
|
||||
{
|
||||
if ($unwrap) {
|
||||
throw $this->exception;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user