@@ -12,11 +12,11 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | final class MockClientStrategy implements DiscoveryStrategy |
| 14 | 14 | { |
| 15 | - public static function getCandidates($type) |
|
| 16 | - { |
|
| 17 | - if (\is_a(HttpClient::class, $type, \true) || \is_a(HttpAsyncClient::class, $type, \true)) { |
|
| 18 | - return [['class' => Mock::class, 'condition' => Mock::class]]; |
|
| 19 | - } |
|
| 20 | - return []; |
|
| 21 | - } |
|
| 15 | + public static function getCandidates($type) |
|
| 16 | + { |
|
| 17 | + if (\is_a(HttpClient::class, $type, \true) || \is_a(HttpAsyncClient::class, $type, \true)) { |
|
| 18 | + return [['class' => Mock::class, 'condition' => Mock::class]]; |
|
| 19 | + } |
|
| 20 | + return []; |
|
| 21 | + } |
|
| 22 | 22 | } |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | * |
| 11 | 11 | * @author Sam Rapaport <[email protected]> |
| 12 | 12 | */ |
| 13 | -final class MockClientStrategy implements DiscoveryStrategy |
|
| 14 | -{ |
|
| 13 | +final class MockClientStrategy implements DiscoveryStrategy { |
|
| 15 | 14 | public static function getCandidates($type) |
| 16 | 15 | { |
| 17 | 16 | if (\is_a(HttpClient::class, $type, \true) || \is_a(HttpAsyncClient::class, $type, \true)) { |
@@ -11,8 +11,7 @@ |
||
| 11 | 11 | * |
| 12 | 12 | * @author Márk Sági-Kazár <[email protected]> |
| 13 | 13 | */ |
| 14 | -class NetworkException extends TransferException implements PsrNetworkException |
|
| 15 | -{ |
|
| 14 | +class NetworkException extends TransferException implements PsrNetworkException { |
|
| 16 | 15 | use RequestAwareTrait; |
| 17 | 16 | /** |
| 18 | 17 | * @param string $message |
@@ -13,13 +13,13 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class NetworkException extends TransferException implements PsrNetworkException |
| 15 | 15 | { |
| 16 | - use RequestAwareTrait; |
|
| 17 | - /** |
|
| 18 | - * @param string $message |
|
| 19 | - */ |
|
| 20 | - public function __construct($message, RequestInterface $request, ?\Exception $previous = null) |
|
| 21 | - { |
|
| 22 | - $this->setRequest($request); |
|
| 23 | - parent::__construct($message, 0, $previous); |
|
| 24 | - } |
|
| 16 | + use RequestAwareTrait; |
|
| 17 | + /** |
|
| 18 | + * @param string $message |
|
| 19 | + */ |
|
| 20 | + public function __construct($message, RequestInterface $request, ?\Exception $previous = null) |
|
| 21 | + { |
|
| 22 | + $this->setRequest($request); |
|
| 23 | + parent::__construct($message, 0, $previous); |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -3,8 +3,7 @@ |
||
| 3 | 3 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Http\Client\Exception; |
| 4 | 4 | |
| 5 | 5 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\RequestInterface; |
| 6 | -trait RequestAwareTrait |
|
| 7 | -{ |
|
| 6 | +trait RequestAwareTrait { |
|
| 8 | 7 | /** |
| 9 | 8 | * @var RequestInterface |
| 10 | 9 | */ |
@@ -5,16 +5,16 @@ |
||
| 5 | 5 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\RequestInterface; |
| 6 | 6 | trait RequestAwareTrait |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * @var RequestInterface |
|
| 10 | - */ |
|
| 11 | - private $request; |
|
| 12 | - private function setRequest(RequestInterface $request) |
|
| 13 | - { |
|
| 14 | - $this->request = $request; |
|
| 15 | - } |
|
| 16 | - public function getRequest() : RequestInterface |
|
| 17 | - { |
|
| 18 | - return $this->request; |
|
| 19 | - } |
|
| 8 | + /** |
|
| 9 | + * @var RequestInterface |
|
| 10 | + */ |
|
| 11 | + private $request; |
|
| 12 | + private function setRequest(RequestInterface $request) |
|
| 13 | + { |
|
| 14 | + $this->request = $request; |
|
| 15 | + } |
|
| 16 | + public function getRequest() : RequestInterface |
|
| 17 | + { |
|
| 18 | + return $this->request; |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | * |
| 13 | 13 | * @author Márk Sági-Kazár <[email protected]> |
| 14 | 14 | */ |
| 15 | -class RequestException extends TransferException implements PsrRequestException |
|
| 16 | -{ |
|
| 15 | +class RequestException extends TransferException implements PsrRequestException { |
|
| 17 | 16 | use RequestAwareTrait; |
| 18 | 17 | /** |
| 19 | 18 | * @param string $message |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class RequestException extends TransferException implements PsrRequestException |
| 16 | 16 | { |
| 17 | - use RequestAwareTrait; |
|
| 18 | - /** |
|
| 19 | - * @param string $message |
|
| 20 | - */ |
|
| 21 | - public function __construct($message, RequestInterface $request, ?\Exception $previous = null) |
|
| 22 | - { |
|
| 23 | - $this->setRequest($request); |
|
| 24 | - parent::__construct($message, 0, $previous); |
|
| 25 | - } |
|
| 17 | + use RequestAwareTrait; |
|
| 18 | + /** |
|
| 19 | + * @param string $message |
|
| 20 | + */ |
|
| 21 | + public function __construct($message, RequestInterface $request, ?\Exception $previous = null) |
|
| 22 | + { |
|
| 23 | + $this->setRequest($request); |
|
| 24 | + parent::__construct($message, 0, $previous); |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -5,8 +5,7 @@ |
||
| 5 | 5 | use OCA\FullTextSearch_Elasticsearch\Vendor\Http\Client\Exception; |
| 6 | 6 | use OCA\FullTextSearch_Elasticsearch\Vendor\Http\Promise\Promise; |
| 7 | 7 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
| 8 | -final class HttpFulfilledPromise implements Promise |
|
| 9 | -{ |
|
| 8 | +final class HttpFulfilledPromise implements Promise { |
|
| 10 | 9 | /** |
| 11 | 10 | * @var ResponseInterface |
| 12 | 11 | */ |
@@ -7,33 +7,33 @@ |
||
| 7 | 7 | use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message\ResponseInterface; |
| 8 | 8 | final class HttpFulfilledPromise implements Promise |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * @var ResponseInterface |
|
| 12 | - */ |
|
| 13 | - private $response; |
|
| 14 | - public function __construct(ResponseInterface $response) |
|
| 15 | - { |
|
| 16 | - $this->response = $response; |
|
| 17 | - } |
|
| 18 | - public function then(?callable $onFulfilled = null, ?callable $onRejected = null) |
|
| 19 | - { |
|
| 20 | - if (null === $onFulfilled) { |
|
| 21 | - return $this; |
|
| 22 | - } |
|
| 23 | - try { |
|
| 24 | - return new self($onFulfilled($this->response)); |
|
| 25 | - } catch (Exception $e) { |
|
| 26 | - return new HttpRejectedPromise($e); |
|
| 27 | - } |
|
| 28 | - } |
|
| 29 | - public function getState() |
|
| 30 | - { |
|
| 31 | - return Promise::FULFILLED; |
|
| 32 | - } |
|
| 33 | - public function wait($unwrap = \true) |
|
| 34 | - { |
|
| 35 | - if ($unwrap) { |
|
| 36 | - return $this->response; |
|
| 37 | - } |
|
| 38 | - } |
|
| 10 | + /** |
|
| 11 | + * @var ResponseInterface |
|
| 12 | + */ |
|
| 13 | + private $response; |
|
| 14 | + public function __construct(ResponseInterface $response) |
|
| 15 | + { |
|
| 16 | + $this->response = $response; |
|
| 17 | + } |
|
| 18 | + public function then(?callable $onFulfilled = null, ?callable $onRejected = null) |
|
| 19 | + { |
|
| 20 | + if (null === $onFulfilled) { |
|
| 21 | + return $this; |
|
| 22 | + } |
|
| 23 | + try { |
|
| 24 | + return new self($onFulfilled($this->response)); |
|
| 25 | + } catch (Exception $e) { |
|
| 26 | + return new HttpRejectedPromise($e); |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | + public function getState() |
|
| 30 | + { |
|
| 31 | + return Promise::FULFILLED; |
|
| 32 | + } |
|
| 33 | + public function wait($unwrap = \true) |
|
| 34 | + { |
|
| 35 | + if ($unwrap) { |
|
| 36 | + return $this->response; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -11,6 +11,5 @@ |
||
| 11 | 11 | * |
| 12 | 12 | * @deprecated since version 2.4, use Psr\Http\Client\ClientInterface instead; see https://www.php-fig.org/psr/psr-18/ |
| 13 | 13 | */ |
| 14 | -interface HttpClient extends ClientInterface |
|
| 15 | -{ |
|
| 14 | +interface HttpClient extends ClientInterface { |
|
| 16 | 15 | } |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use DateTimeImmutable; |
| 6 | 6 | interface ClockInterface |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Returns the current time as a DateTimeImmutable Object |
|
| 10 | - */ |
|
| 11 | - public function now() : DateTimeImmutable; |
|
| 8 | + /** |
|
| 9 | + * Returns the current time as a DateTimeImmutable Object |
|
| 10 | + */ |
|
| 11 | + public function now() : DateTimeImmutable; |
|
| 12 | 12 | } |
@@ -3,8 +3,7 @@ |
||
| 3 | 3 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Clock; |
| 4 | 4 | |
| 5 | 5 | use DateTimeImmutable; |
| 6 | -interface ClockInterface |
|
| 7 | -{ |
|
| 6 | +interface ClockInterface { |
|
| 8 | 7 | /** |
| 9 | 8 | * Returns the current time as a DateTimeImmutable Object |
| 10 | 9 | */ |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | interface ListenerProviderInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @param object $event |
|
| 13 | - * An event for which to return the relevant listeners. |
|
| 14 | - * @return iterable[callable] |
|
| 15 | - * An iterable (array, iterator, or generator) of callables. Each |
|
| 16 | - * callable MUST be type-compatible with $event. |
|
| 17 | - */ |
|
| 18 | - public function getListenersForEvent(object $event) : iterable; |
|
| 11 | + /** |
|
| 12 | + * @param object $event |
|
| 13 | + * An event for which to return the relevant listeners. |
|
| 14 | + * @return iterable[callable] |
|
| 15 | + * An iterable (array, iterator, or generator) of callables. Each |
|
| 16 | + * callable MUST be type-compatible with $event. |
|
| 17 | + */ |
|
| 18 | + public function getListenersForEvent(object $event) : iterable; |
|
| 19 | 19 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare (strict_types=1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\EventDispatcher; |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Mapper from an event to the listeners that are applicable to that event. |
| 8 | 8 | */ |
| 9 | -interface ListenerProviderInterface |
|
| 10 | -{ |
|
| 9 | +interface ListenerProviderInterface { |
|
| 11 | 10 | /** |
| 12 | 11 | * @param object $event |
| 13 | 12 | * An event for which to return the relevant listeners. |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | interface EventDispatcherInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Provide all relevant listeners with an event to process. |
|
| 13 | - * |
|
| 14 | - * @param object $event |
|
| 15 | - * The object to process. |
|
| 16 | - * |
|
| 17 | - * @return object |
|
| 18 | - * The Event that was passed, now modified by listeners. |
|
| 19 | - */ |
|
| 20 | - public function dispatch(object $event); |
|
| 11 | + /** |
|
| 12 | + * Provide all relevant listeners with an event to process. |
|
| 13 | + * |
|
| 14 | + * @param object $event |
|
| 15 | + * The object to process. |
|
| 16 | + * |
|
| 17 | + * @return object |
|
| 18 | + * The Event that was passed, now modified by listeners. |
|
| 19 | + */ |
|
| 20 | + public function dispatch(object $event); |
|
| 21 | 21 | } |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Defines a dispatcher for events. |
| 8 | 8 | */ |
| 9 | -interface EventDispatcherInterface |
|
| 10 | -{ |
|
| 9 | +interface EventDispatcherInterface { |
|
| 11 | 10 | /** |
| 12 | 11 | * Provide all relevant listeners with an event to process. |
| 13 | 12 | * |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare (strict_types=1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\EventDispatcher; |
| 5 | 5 | |
| 6 | 6 | /** |