@@ -120,7 +120,7 @@ |
||
120 | 120 | $container->setDefinition($eventServiceName, $eventService); |
121 | 121 | |
122 | 122 | // Create the event Dispatch Middleware |
123 | - $eventExpression = new Expression(sprintf("service('%s').dispatchEvent()", $eventServiceName)); |
|
123 | + $eventExpression = new Expression(sprintf("service('%s').dispatchEvent()", $eventServiceName)); |
|
124 | 124 | |
125 | 125 | $handler = new Definition(HandlerStack::class); |
126 | 126 | $handler->setFactory([HandlerStack::class, 'create']); |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function dispatchEvent() : \Closure |
41 | 41 | { |
42 | - return function (callable $handler) { |
|
42 | + return function(callable $handler) { |
|
43 | 43 | |
44 | - return function ( |
|
44 | + return function( |
|
45 | 45 | RequestInterface $request, |
46 | 46 | array $options |
47 | 47 | ) use ($handler) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | // Handle the response form the server. |
58 | 58 | return $promise->then( |
59 | - function (ResponseInterface $response) { |
|
59 | + function(ResponseInterface $response) { |
|
60 | 60 | // Create the Post Transaction event. |
61 | 61 | $postTransactionEvent = new PostTransactionEvent($response, $this->serviceName); |
62 | 62 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // Continue down the chain. |
67 | 67 | return $postTransactionEvent->getTransaction(); |
68 | 68 | }, |
69 | - function (Exception $reason) { |
|
69 | + function(Exception $reason) { |
|
70 | 70 | // Get the response. The response in a RequestException can be null too. |
71 | 71 | $response = $reason instanceof RequestException ? $reason->getResponse() : null; |
72 | 72 |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | $logger = $this->logger; |
45 | 45 | $formatter = $this->formatter; |
46 | 46 | |
47 | - return function (callable $handler) use ($logger, $formatter) { |
|
47 | + return function(callable $handler) use ($logger, $formatter) { |
|
48 | 48 | |
49 | - return function ($request, array $options) use ($handler, $logger, $formatter) { |
|
49 | + return function($request, array $options) use ($handler, $logger, $formatter) { |
|
50 | 50 | |
51 | 51 | return $handler($request, $options)->then( |
52 | 52 | |
53 | - function ($response) use ($logger, $request, $formatter) { |
|
53 | + function($response) use ($logger, $request, $formatter) { |
|
54 | 54 | |
55 | 55 | $message = $formatter->format($request, $response); |
56 | 56 | $context = compact('request', 'response'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return $response; |
61 | 61 | }, |
62 | 62 | |
63 | - function ($reason) use ($logger, $request, $formatter) { |
|
63 | + function($reason) use ($logger, $request, $formatter) { |
|
64 | 64 | |
65 | 65 | $response = $reason instanceof RequestException ? $reason->getResponse() : null; |
66 | 66 | $message = $formatter->format($request, $response, $reason); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __invoke(callable $handler) : \Closure |
28 | 28 | { |
29 | - return function ( |
|
29 | + return function( |
|
30 | 30 | RequestInterface $request, |
31 | 31 | array $options |
32 | 32 | ) use ($handler) { |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function getOnStatsCallback($initialOnStats) : \Closure |
49 | 49 | { |
50 | - return function (TransferStats $stats) use ($initialOnStats) { |
|
50 | + return function(TransferStats $stats) use ($initialOnStats) { |
|
51 | 51 | if (is_callable($initialOnStats)) { |
52 | 52 | call_user_func($initialOnStats, $stats); |
53 | 53 | } |
54 | 54 | |
55 | - $this->dataCollector->addTotalTime((float)$stats->getTransferTime()); |
|
55 | + $this->dataCollector->addTotalTime((float) $stats->getTransferTime()); |
|
56 | 56 | }; |
57 | 57 | } |
58 | 58 | } |
@@ -112,7 +112,7 @@ |
||
112 | 112 | */ |
113 | 113 | public function getErrorCount() : int |
114 | 114 | { |
115 | - return count(array_filter($this->getMessages(), function (LogMessage $message) { |
|
115 | + return count(array_filter($this->getMessages(), function(LogMessage $message) { |
|
116 | 116 | return $message->getLevel() === LogLevel::ERROR; |
117 | 117 | })); |
118 | 118 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | $logger = $this->logger; |
35 | 35 | $formatter = $this->formatter; |
36 | 36 | |
37 | - return function ($request, array $options) use ($handler, $logger, $formatter) { |
|
37 | + return function($request, array $options) use ($handler, $logger, $formatter) { |
|
38 | 38 | |
39 | 39 | return $handler($request, $options)->then( |
40 | 40 | |
41 | - function ($response) use ($logger, $request, $formatter) { |
|
41 | + function($response) use ($logger, $request, $formatter) { |
|
42 | 42 | $message = $formatter->format($request, $response); |
43 | 43 | |
44 | 44 | $logger->info($message); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $response; |
47 | 47 | }, |
48 | 48 | |
49 | - function ($reason) use ($logger, $request, $formatter) { |
|
49 | + function($reason) use ($logger, $request, $formatter) { |
|
50 | 50 | $response = $reason instanceof RequestException ? $reason->getResponse() : null; |
51 | 51 | $message = $formatter->format($request, $response, $reason); |
52 | 52 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ->scalarNode('base_url') |
79 | 79 | ->defaultValue(null) |
80 | 80 | ->validate() |
81 | - ->ifTrue(function ($v) { |
|
81 | + ->ifTrue(function($v) { |
|
82 | 82 | return !is_string($v); |
83 | 83 | }) |
84 | 84 | ->thenInvalid('base_url can be: string') |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ->end() |
87 | 87 | ->arrayNode('options') |
88 | 88 | ->validate() |
89 | - ->ifTrue(function ($options) { |
|
89 | + ->ifTrue(function($options) { |
|
90 | 90 | return count($options['form_params']) && count($options['multipart']); |
91 | 91 | }) |
92 | 92 | ->thenInvalid('You cannot use form_params and multipart at the same time.') |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ->end() |
100 | 100 | ->variableNode('allow_redirects') |
101 | 101 | ->validate() |
102 | - ->ifTrue(function ($v) { |
|
102 | + ->ifTrue(function($v) { |
|
103 | 103 | return !is_array($v) && !is_bool($v); |
104 | 104 | }) |
105 | 105 | ->thenInvalid('allow_redirects can be: bool or array') |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ->end() |
108 | 108 | ->variableNode('auth') |
109 | 109 | ->validate() |
110 | - ->ifTrue(function ($v) { |
|
110 | + ->ifTrue(function($v) { |
|
111 | 111 | return !is_array($v) && !is_string($v); |
112 | 112 | }) |
113 | 113 | ->thenInvalid('auth can be: string or array') |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ->end() |
116 | 116 | ->variableNode('query') |
117 | 117 | ->validate() |
118 | - ->ifTrue(function ($v) { |
|
118 | + ->ifTrue(function($v) { |
|
119 | 119 | return !is_string($v) && !is_array($v); |
120 | 120 | }) |
121 | 121 | ->thenInvalid('query can be: string or array') |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | ->arrayNode('curl') |
125 | 125 | ->beforeNormalization() |
126 | 126 | ->ifArray() |
127 | - ->then(function (array $curlOptions) { |
|
127 | + ->then(function(array $curlOptions) { |
|
128 | 128 | $result = []; |
129 | 129 | |
130 | 130 | foreach ($curlOptions as $key => $value) { |
131 | - $optionName = 'CURLOPT_' . strtoupper($key); |
|
131 | + $optionName = 'CURLOPT_'.strtoupper($key); |
|
132 | 132 | |
133 | 133 | if (!defined($optionName)) { |
134 | 134 | throw new InvalidConfigurationException(sprintf( |
135 | - 'Invalid curl option in eight_points_guzzle: %s. ' . |
|
136 | - 'Ex: use sslversion for CURLOPT_SSLVERSION option. ' . PHP_EOL . |
|
135 | + 'Invalid curl option in eight_points_guzzle: %s. '. |
|
136 | + 'Ex: use sslversion for CURLOPT_SSLVERSION option. '.PHP_EOL. |
|
137 | 137 | 'See all available options: http://php.net/manual/en/function.curl-setopt.php', |
138 | 138 | $key |
139 | 139 | )); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ->end() |
151 | 151 | ->variableNode('cert') |
152 | 152 | ->validate() |
153 | - ->ifTrue(function ($v) { |
|
153 | + ->ifTrue(function($v) { |
|
154 | 154 | return !is_string($v) && (!is_array($v) || count($v) !== 2); |
155 | 155 | }) |
156 | 156 | ->thenInvalid('cert can be: string or array with two entries (path and password)') |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | ->end() |
159 | 159 | ->scalarNode('connect_timeout') |
160 | 160 | ->beforeNormalization() |
161 | - ->always(function ($v) { |
|
161 | + ->always(function($v) { |
|
162 | 162 | return is_numeric($v) ? (float) $v : $v; |
163 | 163 | }) |
164 | 164 | ->end() |
165 | 165 | ->validate() |
166 | - ->ifTrue(function ($v) { |
|
166 | + ->ifTrue(function($v) { |
|
167 | 167 | return !is_float($v) && !(is_string($v) && strpos($v, 'env_') === 0); |
168 | 168 | }) |
169 | 169 | ->thenInvalid('connect_timeout can be: float') |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ->booleanNode('debug')->end() |
173 | 173 | ->variableNode('decode_content') |
174 | 174 | ->validate() |
175 | - ->ifTrue(function ($v) { |
|
175 | + ->ifTrue(function($v) { |
|
176 | 176 | return !is_string($v) && !is_bool($v); |
177 | 177 | }) |
178 | 178 | ->thenInvalid('decode_content can be: bool or string (gzip, compress, deflate, etc...)') |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ->end() |
190 | 190 | ->scalarNode('sink') |
191 | 191 | ->validate() |
192 | - ->ifTrue(function ($v) { |
|
192 | + ->ifTrue(function($v) { |
|
193 | 193 | return !is_string($v); |
194 | 194 | }) |
195 | 195 | ->thenInvalid('sink can be: string') |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | ->booleanNode('http_errors')->end() |
199 | 199 | ->variableNode('expect') |
200 | 200 | ->validate() |
201 | - ->ifTrue(function ($v) { |
|
201 | + ->ifTrue(function($v) { |
|
202 | 202 | return !is_bool($v) && !is_int($v); |
203 | 203 | }) |
204 | 204 | ->thenInvalid('expect can be: bool or int') |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | ->end() |
207 | 207 | ->variableNode('ssl_key') |
208 | 208 | ->validate() |
209 | - ->ifTrue(function ($v) { |
|
209 | + ->ifTrue(function($v) { |
|
210 | 210 | return !is_string($v) && (!is_array($v) || count($v) !== 2); |
211 | 211 | }) |
212 | 212 | ->thenInvalid('ssl_key can be: string or array with two entries (path and password)') |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | ->booleanNode('synchronous')->end() |
217 | 217 | ->scalarNode('read_timeout') |
218 | 218 | ->beforeNormalization() |
219 | - ->always(function ($v) { |
|
219 | + ->always(function($v) { |
|
220 | 220 | return is_numeric($v) ? (float) $v : $v; |
221 | 221 | }) |
222 | 222 | ->end() |
223 | 223 | ->validate() |
224 | - ->ifTrue(function ($v) { |
|
224 | + ->ifTrue(function($v) { |
|
225 | 225 | return !is_float($v) && !(is_string($v) && strpos($v, 'env_') === 0); |
226 | 226 | }) |
227 | 227 | ->thenInvalid('read_timeout can be: float') |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | ->end() |
230 | 230 | ->scalarNode('timeout') |
231 | 231 | ->beforeNormalization() |
232 | - ->always(function ($v) { |
|
232 | + ->always(function($v) { |
|
233 | 233 | return is_numeric($v) ? (float) $v : $v; |
234 | 234 | }) |
235 | 235 | ->end() |
236 | 236 | ->validate() |
237 | - ->ifTrue(function ($v) { |
|
237 | + ->ifTrue(function($v) { |
|
238 | 238 | return !is_float($v) && !(is_string($v) && strpos($v, 'env_') === 0); |
239 | 239 | }) |
240 | 240 | ->thenInvalid('timeout can be: float') |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ->end() |
243 | 243 | ->variableNode('verify') |
244 | 244 | ->validate() |
245 | - ->ifTrue(function ($v) { |
|
245 | + ->ifTrue(function($v) { |
|
246 | 246 | return !is_bool($v) && !is_string($v); |
247 | 247 | }) |
248 | 248 | ->thenInvalid('verify can be: bool or string') |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ->end() |
273 | 273 | ->scalarNode('version') |
274 | 274 | ->validate() |
275 | - ->ifTrue(function ($v) { |
|
275 | + ->ifTrue(function($v) { |
|
276 | 276 | return !is_string($v) && !is_float($v); |
277 | 277 | }) |
278 | 278 | ->thenInvalid('version can be: string or float') |