@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise |
46 | 46 | { |
47 | - $addHostNext = function (RequestInterface $request) use ($next, $first) { |
|
47 | + $addHostNext = function(RequestInterface $request) use ($next, $first) { |
|
48 | 48 | return $this->addHostPlugin->handleRequest($request, $next, $first); |
49 | 49 | }; |
50 | 50 |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | $resolver = new OptionsResolver(); |
71 | 71 | $resolver->setDefaults([ |
72 | 72 | 'retries' => 1, |
73 | - 'error_response_decider' => function (RequestInterface $request, ResponseInterface $response) { |
|
73 | + 'error_response_decider' => function(RequestInterface $request, ResponseInterface $response) { |
|
74 | 74 | // do not retry client errors |
75 | 75 | return $response->getStatusCode() >= 500 && $response->getStatusCode() < 600; |
76 | 76 | }, |
77 | - 'exception_decider' => function (RequestInterface $request, ClientExceptionInterface $e) { |
|
77 | + 'exception_decider' => function(RequestInterface $request, ClientExceptionInterface $e) { |
|
78 | 78 | // do not retry client errors |
79 | 79 | return !$e instanceof HttpException || $e->getCode() >= 500 && $e->getCode() < 600; |
80 | 80 | }, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $chainIdentifier = spl_object_hash((object) $first); |
105 | 105 | |
106 | - return $next($request)->then(function (ResponseInterface $response) use ($request, $next, $first, $chainIdentifier) { |
|
106 | + return $next($request)->then(function(ResponseInterface $response) use ($request, $next, $first, $chainIdentifier) { |
|
107 | 107 | if (!array_key_exists($chainIdentifier, $this->retryStorage)) { |
108 | 108 | $this->retryStorage[$chainIdentifier] = 0; |
109 | 109 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | return $response; |
127 | - }, function (ClientExceptionInterface $exception) use ($request, $next, $first, $chainIdentifier) { |
|
127 | + }, function(ClientExceptionInterface $exception) use ($request, $next, $first, $chainIdentifier) { |
|
128 | 128 | if (!array_key_exists($chainIdentifier, $this->retryStorage)) { |
129 | 129 | $this->retryStorage[$chainIdentifier] = 0; |
130 | 130 | } |
@@ -70,8 +70,8 @@ |
||
70 | 70 | |
71 | 71 | if (substr($path, 0, strlen($prepend)) !== $prepend) { |
72 | 72 | $request = $request->withUri($request->getUri() |
73 | - ->withPath($prepend.$path) |
|
74 | - ); |
|
73 | + ->withPath($prepend.$path) |
|
74 | + ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $next($request); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ]); |
118 | 118 | $resolver->setAllowedTypes('preserve_header', ['bool', 'array']); |
119 | 119 | $resolver->setAllowedTypes('use_default_for_multiple', 'bool'); |
120 | - $resolver->setNormalizer('preserve_header', function (OptionsResolver $resolver, $value) { |
|
120 | + $resolver->setNormalizer('preserve_header', function(OptionsResolver $resolver, $value) { |
|
121 | 121 | if (is_bool($value) && false === $value) { |
122 | 122 | return []; |
123 | 123 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | return $first($redirectRequest); |
145 | 145 | } |
146 | 146 | |
147 | - return $next($request)->then(function (ResponseInterface $response) use ($request, $first): ResponseInterface { |
|
147 | + return $next($request)->then(function(ResponseInterface $response) use ($request, $first): ResponseInterface { |
|
148 | 148 | $statusCode = $response->getStatusCode(); |
149 | 149 | |
150 | 150 | if (!array_key_exists($statusCode, $this->redirectCodes)) { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | $promise = $next($request); |
63 | 63 | |
64 | - return $promise->then(function (ResponseInterface $response) use ($request) { |
|
64 | + return $promise->then(function(ResponseInterface $response) use ($request) { |
|
65 | 65 | return $this->transformResponseToException($request, $response); |
66 | 66 | }); |
67 | 67 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | // Else we want to use the synchronous call of the underlying client, and not the async one in the case |
82 | 82 | // we have both an async and sync call |
83 | - $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { |
|
83 | + $pluginChain = $this->createPluginChain($this->plugins, function(RequestInterface $request) { |
|
84 | 84 | try { |
85 | 85 | return new HttpFulfilledPromise($this->client->sendRequest($request)); |
86 | 86 | } catch (HttplugException $exception) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function sendAsyncRequest(RequestInterface $request) |
98 | 98 | { |
99 | - $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { |
|
99 | + $pluginChain = $this->createPluginChain($this->plugins, function(RequestInterface $request) { |
|
100 | 100 | return $this->client->sendAsyncRequest($request); |
101 | 101 | }); |
102 | 102 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $firstCallable = $lastCallable = $clientCallable; |
130 | 130 | |
131 | 131 | while ($plugin = array_pop($pluginList)) { |
132 | - $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable, &$firstCallable) { |
|
132 | + $lastCallable = function(RequestInterface $request) use ($plugin, $lastCallable, &$firstCallable) { |
|
133 | 133 | return $plugin->handleRequest($request, $lastCallable, $firstCallable); |
134 | 134 | }; |
135 | 135 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | $firstCalls = 0; |
140 | - $firstCallable = function (RequestInterface $request) use ($lastCallable, &$firstCalls) { |
|
140 | + $firstCallable = function(RequestInterface $request) use ($lastCallable, &$firstCalls) { |
|
141 | 141 | if ($firstCalls > $this->options['max_restarts']) { |
142 | 142 | throw new LoopException('Too many restarts in plugin client', $request); |
143 | 143 | } |
@@ -24,6 +24,6 @@ |
||
24 | 24 | return [['class' => Mock::class, 'condition' => Mock::class]]; |
25 | 25 | default: |
26 | 26 | return []; |
27 | - } |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function __construct($strategy, array $candidates) |
19 | 19 | { |
20 | 20 | $classes = array_map( |
21 | - function ($a) { |
|
21 | + function($a) { |
|
22 | 22 | return $a['class']; |
23 | 23 | }, |
24 | 24 | $candidates |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function __construct(Authentication $authentication, callable $matcher = null) |
35 | 35 | { |
36 | 36 | if (is_null($matcher)) { |
37 | - $matcher = function () { |
|
37 | + $matcher = function() { |
|
38 | 38 | return true; |
39 | 39 | }; |
40 | 40 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public static function createUrlMatcher(Authentication $authentication, $url) |
67 | 67 | { |
68 | - $matcher = function (RequestInterface $request) use ($url) { |
|
68 | + $matcher = function(RequestInterface $request) use ($url) { |
|
69 | 69 | return preg_match($url, $request->getRequestTarget()); |
70 | 70 | }; |
71 | 71 |