Completed
Pull Request — master (#359)
by Maxence
41s
created
lib/Vendor/Http/Discovery/NotFoundException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,6 +11,5 @@
 block discarded – undo
11 11
  *
12 12
  * @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \OCA\FullTextSearch_Elasticsearch\Vendor\Http\Discovery\Exception\NotFoundException} instead.
13 13
  */
14
-final class NotFoundException extends RealNotFoundException
15
-{
14
+final class NotFoundException extends RealNotFoundException {
16 15
 }
Please login to merge, or discard this patch.
lib/Vendor/Http/Discovery/MessageFactoryDiscovery.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
  */
15 15
 final class MessageFactoryDiscovery extends ClassDiscovery
16 16
 {
17
-    /**
18
-     * Finds a Message Factory.
19
-     *
20
-     * @return MessageFactory
21
-     *
22
-     * @throws Exception\NotFoundException
23
-     */
24
-    public static function find()
25
-    {
26
-        try {
27
-            $messageFactory = static::findOneByType(MessageFactory::class);
28
-        } catch (DiscoveryFailedException $e) {
29
-            throw new NotFoundException('No php-http message factories found. Note that the php-http message factories are deprecated in favor of the PSR-17 message factories. To use the legacy Guzzle, Diactoros or Slim Framework factories of php-http, install php-http/message and php-http/message-factory and the chosen message implementation.', 0, $e);
30
-        }
17
+	/**
18
+	 * Finds a Message Factory.
19
+	 *
20
+	 * @return MessageFactory
21
+	 *
22
+	 * @throws Exception\NotFoundException
23
+	 */
24
+	public static function find()
25
+	{
26
+		try {
27
+			$messageFactory = static::findOneByType(MessageFactory::class);
28
+		} catch (DiscoveryFailedException $e) {
29
+			throw new NotFoundException('No php-http message factories found. Note that the php-http message factories are deprecated in favor of the PSR-17 message factories. To use the legacy Guzzle, Diactoros or Slim Framework factories of php-http, install php-http/message and php-http/message-factory and the chosen message implementation.', 0, $e);
30
+		}
31 31
 
32
-        return static::instantiateClass($messageFactory);
33
-    }
32
+		return static::instantiateClass($messageFactory);
33
+	}
34 34
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
  *
13 13
  * @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery.
14 14
  */
15
-final class MessageFactoryDiscovery extends ClassDiscovery
16
-{
15
+final class MessageFactoryDiscovery extends ClassDiscovery {
17 16
     /**
18 17
      * Finds a Message Factory.
19 18
      *
Please login to merge, or discard this patch.
lib/Vendor/Http/Promise/FulfilledPromise.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@
 block discarded – undo
9 9
  */
10 10
 final class FulfilledPromise implements Promise
11 11
 {
12
-    /**
13
-     * @var mixed
14
-     */
15
-    private $result;
16
-
17
-    /**
18
-     * @param mixed $result
19
-     */
20
-    public function __construct($result)
21
-    {
22
-        $this->result = $result;
23
-    }
24
-
25
-    public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
26
-    {
27
-        if (null === $onFulfilled) {
28
-            return $this;
29
-        }
30
-
31
-        try {
32
-            return new self($onFulfilled($this->result));
33
-        } catch (\Exception $e) {
34
-            return new RejectedPromise($e);
35
-        }
36
-    }
37
-
38
-    public function getState()
39
-    {
40
-        return Promise::FULFILLED;
41
-    }
42
-
43
-    public function wait($unwrap = true)
44
-    {
45
-        if ($unwrap) {
46
-            return $this->result;
47
-        }
48
-
49
-        return null;
50
-    }
12
+	/**
13
+	 * @var mixed
14
+	 */
15
+	private $result;
16
+
17
+	/**
18
+	 * @param mixed $result
19
+	 */
20
+	public function __construct($result)
21
+	{
22
+		$this->result = $result;
23
+	}
24
+
25
+	public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
26
+	{
27
+		if (null === $onFulfilled) {
28
+			return $this;
29
+		}
30
+
31
+		try {
32
+			return new self($onFulfilled($this->result));
33
+		} catch (\Exception $e) {
34
+			return new RejectedPromise($e);
35
+		}
36
+	}
37
+
38
+	public function getState()
39
+	{
40
+		return Promise::FULFILLED;
41
+	}
42
+
43
+	public function wait($unwrap = true)
44
+	{
45
+		if ($unwrap) {
46
+			return $this->result;
47
+		}
48
+
49
+		return null;
50
+	}
51 51
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
  *
8 8
  * @author Joel Wurtz <[email protected]>
9 9
  */
10
-final class FulfilledPromise implements Promise
11
-{
10
+final class FulfilledPromise implements Promise {
12 11
     /**
13 12
      * @var mixed
14 13
      */
Please login to merge, or discard this patch.
lib/Vendor/Http/Promise/Promise.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -15,55 +15,55 @@
 block discarded – undo
15 15
  */
16 16
 interface Promise
17 17
 {
18
-    /**
19
-     * Promise has not been fulfilled or rejected.
20
-     */
21
-    const PENDING = 'pending';
18
+	/**
19
+	 * Promise has not been fulfilled or rejected.
20
+	 */
21
+	const PENDING = 'pending';
22 22
 
23
-    /**
24
-     * Promise has been fulfilled.
25
-     */
26
-    const FULFILLED = 'fulfilled';
23
+	/**
24
+	 * Promise has been fulfilled.
25
+	 */
26
+	const FULFILLED = 'fulfilled';
27 27
 
28
-    /**
29
-     * Promise has been rejected.
30
-     */
31
-    const REJECTED = 'rejected';
28
+	/**
29
+	 * Promise has been rejected.
30
+	 */
31
+	const REJECTED = 'rejected';
32 32
 
33
-    /**
34
-     * Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
35
-     *
36
-     * If you do not care about one of the cases, you can set the corresponding callable to null
37
-     * The callback will be called when the value arrived and never more than once.
38
-     *
39
-     * @param callable|null $onFulfilled called when a response will be available
40
-     * @param callable|null $onRejected  called when an exception occurs
41
-     *
42
-     * @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)
43
-     */
44
-    public function then(?callable $onFulfilled = null, ?callable $onRejected = null);
33
+	/**
34
+	 * Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
35
+	 *
36
+	 * If you do not care about one of the cases, you can set the corresponding callable to null
37
+	 * The callback will be called when the value arrived and never more than once.
38
+	 *
39
+	 * @param callable|null $onFulfilled called when a response will be available
40
+	 * @param callable|null $onRejected  called when an exception occurs
41
+	 *
42
+	 * @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)
43
+	 */
44
+	public function then(?callable $onFulfilled = null, ?callable $onRejected = null);
45 45
 
46
-    /**
47
-     * Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
48
-     *
49
-     * @return string
50
-     */
51
-    public function getState();
46
+	/**
47
+	 * Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
48
+	 *
49
+	 * @return string
50
+	 */
51
+	public function getState();
52 52
 
53
-    /**
54
-     * Wait for the promise to be fulfilled or rejected.
55
-     *
56
-     * When this method returns, the request has been resolved and if callables have been
57
-     * specified, the appropriate one has terminated.
58
-     *
59
-     * When $unwrap is true (the default), the response is returned, or the exception thrown
60
-     * on failure. Otherwise, nothing is returned or thrown.
61
-     *
62
-     * @param bool $unwrap Whether to return resolved value / throw reason or not
63
-     *
64
-     * @return ($unwrap is true ? mixed : null) Resolved value, null if $unwrap is set to false
65
-     *
66
-     * @throws \Throwable the rejection reason if $unwrap is set to true and the request failed
67
-     */
68
-    public function wait($unwrap = true);
53
+	/**
54
+	 * Wait for the promise to be fulfilled or rejected.
55
+	 *
56
+	 * When this method returns, the request has been resolved and if callables have been
57
+	 * specified, the appropriate one has terminated.
58
+	 *
59
+	 * When $unwrap is true (the default), the response is returned, or the exception thrown
60
+	 * on failure. Otherwise, nothing is returned or thrown.
61
+	 *
62
+	 * @param bool $unwrap Whether to return resolved value / throw reason or not
63
+	 *
64
+	 * @return ($unwrap is true ? mixed : null) Resolved value, null if $unwrap is set to false
65
+	 *
66
+	 * @throws \Throwable the rejection reason if $unwrap is set to true and the request failed
67
+	 */
68
+	public function wait($unwrap = true);
69 69
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
  * @author Joel Wurtz <[email protected]>
14 14
  * @author Márk Sági-Kazár <[email protected]>
15 15
  */
16
-interface Promise
17
-{
16
+interface Promise {
18 17
     /**
19 18
      * Promise has not been fulfilled or rejected.
20 19
      */
Please login to merge, or discard this patch.
lib/Vendor/Http/Promise/RejectedPromise.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,40 +9,40 @@
 block discarded – undo
9 9
  */
10 10
 final class RejectedPromise implements Promise
11 11
 {
12
-    /**
13
-     * @var \Throwable
14
-     */
15
-    private $exception;
16
-
17
-    public function __construct(\Throwable $exception)
18
-    {
19
-        $this->exception = $exception;
20
-    }
21
-
22
-    public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
23
-    {
24
-        if (null === $onRejected) {
25
-            return $this;
26
-        }
27
-
28
-        try {
29
-            return new FulfilledPromise($onRejected($this->exception));
30
-        } catch (\Exception $e) {
31
-            return new self($e);
32
-        }
33
-    }
34
-
35
-    public function getState()
36
-    {
37
-        return Promise::REJECTED;
38
-    }
39
-
40
-    public function wait($unwrap = true)
41
-    {
42
-        if ($unwrap) {
43
-            throw $this->exception;
44
-        }
45
-
46
-        return null;
47
-    }
12
+	/**
13
+	 * @var \Throwable
14
+	 */
15
+	private $exception;
16
+
17
+	public function __construct(\Throwable $exception)
18
+	{
19
+		$this->exception = $exception;
20
+	}
21
+
22
+	public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
23
+	{
24
+		if (null === $onRejected) {
25
+			return $this;
26
+		}
27
+
28
+		try {
29
+			return new FulfilledPromise($onRejected($this->exception));
30
+		} catch (\Exception $e) {
31
+			return new self($e);
32
+		}
33
+	}
34
+
35
+	public function getState()
36
+	{
37
+		return Promise::REJECTED;
38
+	}
39
+
40
+	public function wait($unwrap = true)
41
+	{
42
+		if ($unwrap) {
43
+			throw $this->exception;
44
+		}
45
+
46
+		return null;
47
+	}
48 48
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
  *
8 8
  * @author Joel Wurtz <[email protected]>
9 9
  */
10
-final class RejectedPromise implements Promise
11
-{
10
+final class RejectedPromise implements Promise {
12 11
     /**
13 12
      * @var \Throwable
14 13
      */
Please login to merge, or discard this patch.
lib/Vendor/Http/Client/HttpClient.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,6 +12,5 @@
 block discarded – undo
12 12
  *
13 13
  * @deprecated since version 2.4, use OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Client\ClientInterface instead; see https://www.php-fig.org/psr/psr-18/
14 14
  */
15
-interface HttpClient extends ClientInterface
16
-{
15
+interface HttpClient extends ClientInterface {
17 16
 }
Please login to merge, or discard this patch.
lib/Vendor/Http/Client/Exception.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,6 +9,5 @@
 block discarded – undo
9 9
  *
10 10
  * @author Márk Sági-Kazár <[email protected]>
11 11
  */
12
-interface Exception extends PsrClientException
13
-{
12
+interface Exception extends PsrClientException {
14 13
 }
Please login to merge, or discard this patch.
lib/Vendor/Http/Client/HttpAsyncClient.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
  */
13 13
 interface HttpAsyncClient
14 14
 {
15
-    /**
16
-     * Sends a PSR-7 request in an asynchronous way.
17
-     *
18
-     * Exceptions related to processing the request are available from the returned Promise.
19
-     *
20
-     * @return Promise resolves a PSR-7 Response or fails with an OCA\FullTextSearch_Elasticsearch\Vendor\Http\Client\Exception
21
-     *
22
-     * @throws \Exception If processing the request is impossible (eg. bad configuration).
23
-     */
24
-    public function sendAsyncRequest(RequestInterface $request);
15
+	/**
16
+	 * Sends a PSR-7 request in an asynchronous way.
17
+	 *
18
+	 * Exceptions related to processing the request are available from the returned Promise.
19
+	 *
20
+	 * @return Promise resolves a PSR-7 Response or fails with an OCA\FullTextSearch_Elasticsearch\Vendor\Http\Client\Exception
21
+	 *
22
+	 * @throws \Exception If processing the request is impossible (eg. bad configuration).
23
+	 */
24
+	public function sendAsyncRequest(RequestInterface $request);
25 25
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
  *
11 11
  * @author Joel Wurtz <[email protected]>
12 12
  */
13
-interface HttpAsyncClient
14
-{
13
+interface HttpAsyncClient {
15 14
     /**
16 15
      * Sends a PSR-7 request in an asynchronous way.
17 16
      *
Please login to merge, or discard this patch.
lib/Vendor/Http/Client/Exception/HttpException.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -14,52 +14,52 @@
 block discarded – undo
14 14
  */
15 15
 class HttpException extends RequestException
16 16
 {
17
-    /**
18
-     * @var ResponseInterface
19
-     */
20
-    protected $response;
17
+	/**
18
+	 * @var ResponseInterface
19
+	 */
20
+	protected $response;
21 21
 
22
-    /**
23
-     * @param string $message
24
-     */
25
-    public function __construct(
26
-        $message,
27
-        RequestInterface $request,
28
-        ResponseInterface $response,
29
-        \Exception $previous = null
30
-    ) {
31
-        parent::__construct($message, $request, $previous);
22
+	/**
23
+	 * @param string $message
24
+	 */
25
+	public function __construct(
26
+		$message,
27
+		RequestInterface $request,
28
+		ResponseInterface $response,
29
+		\Exception $previous = null
30
+	) {
31
+		parent::__construct($message, $request, $previous);
32 32
 
33
-        $this->response = $response;
34
-        $this->code = $response->getStatusCode();
35
-    }
33
+		$this->response = $response;
34
+		$this->code = $response->getStatusCode();
35
+	}
36 36
 
37
-    /**
38
-     * Returns the response.
39
-     *
40
-     * @return ResponseInterface
41
-     */
42
-    public function getResponse()
43
-    {
44
-        return $this->response;
45
-    }
37
+	/**
38
+	 * Returns the response.
39
+	 *
40
+	 * @return ResponseInterface
41
+	 */
42
+	public function getResponse()
43
+	{
44
+		return $this->response;
45
+	}
46 46
 
47
-    /**
48
-     * Factory method to create a new exception with a normalized error message.
49
-     */
50
-    public static function create(
51
-        RequestInterface $request,
52
-        ResponseInterface $response,
53
-        \Exception $previous = null
54
-    ) {
55
-        $message = sprintf(
56
-            '[url] %s [http method] %s [status code] %s [reason phrase] %s',
57
-            $request->getRequestTarget(),
58
-            $request->getMethod(),
59
-            $response->getStatusCode(),
60
-            $response->getReasonPhrase()
61
-        );
47
+	/**
48
+	 * Factory method to create a new exception with a normalized error message.
49
+	 */
50
+	public static function create(
51
+		RequestInterface $request,
52
+		ResponseInterface $response,
53
+		\Exception $previous = null
54
+	) {
55
+		$message = sprintf(
56
+			'[url] %s [http method] %s [status code] %s [reason phrase] %s',
57
+			$request->getRequestTarget(),
58
+			$request->getMethod(),
59
+			$response->getStatusCode(),
60
+			$response->getReasonPhrase()
61
+		);
62 62
 
63
-        return new static($message, $request, $response, $previous);
64
-    }
63
+		return new static($message, $request, $response, $previous);
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
  *
13 13
  * @author Márk Sági-Kazár <[email protected]>
14 14
  */
15
-class HttpException extends RequestException
16
-{
15
+class HttpException extends RequestException {
17 16
     /**
18 17
      * @var ResponseInterface
19 18
      */
Please login to merge, or discard this patch.