@@ -59,7 +59,7 @@ |
||
59 | 59 | $response->getBody()->rewind(); |
60 | 60 | } |
61 | 61 | } else { |
62 | - $this->setBody(EightPointsGuzzleBundle::class . ': [response body log disabled]'); |
|
62 | + $this->setBody(EightPointsGuzzleBundle::class.': [response body log disabled]'); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -178,7 +178,7 @@ |
||
178 | 178 | } elseif ($logMode === false) { |
179 | 179 | return Logger::LOG_MODE_NONE; |
180 | 180 | } else { |
181 | - return $logMode; |
|
181 | + return $logMode; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | $container->setDefinition($serviceName, $client); |
94 | 94 | } |
95 | 95 | |
96 | - $clientsWithLogging = array_filter($config['clients'], function ($options) use ($logging) { |
|
96 | + $clientsWithLogging = array_filter($config['clients'], function($options) use ($logging) { |
|
97 | 97 | return $options['logging'] !== false && $logging !== false; |
98 | 98 | }); |
99 | 99 | |
100 | - if (count($clientsWithLogging)>0) { |
|
100 | + if (count($clientsWithLogging) > 0) { |
|
101 | 101 | $this->defineTwigDebugExtension($container); |
102 | 102 | $this->defineDataCollector($container, $config['slow_response_time'] / 1000); |
103 | 103 | $this->defineFormatter($container); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $container->setDefinition($eventServiceName, $eventService); |
126 | 126 | |
127 | 127 | // Create the event Dispatch Middleware |
128 | - $eventExpression = new Expression(sprintf("service('%s').dispatchEvent()", $eventServiceName)); |
|
128 | + $eventExpression = new Expression(sprintf("service('%s').dispatchEvent()", $eventServiceName)); |
|
129 | 129 | |
130 | 130 | $handler = new Definition(HandlerStack::class); |
131 | 131 | $handler->setFactory([HandlerStack::class, 'create']); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | private function convertLogMode($logMode) : int |
175 | 175 | { |
176 | - if ($logMode === true){ |
|
176 | + if ($logMode === true) { |
|
177 | 177 | return Logger::LOG_MODE_REQUEST_AND_RESPONSE; |
178 | 178 | } elseif ($logMode === false) { |
179 | 179 | return Logger::LOG_MODE_NONE; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | protected function defineDataCollector(ContainerBuilder $container, float $slowResponseTime) : void |
231 | 231 | { |
232 | 232 | $dataCollectorDefinition = new Definition('%eight_points_guzzle.data_collector.class%'); |
233 | - $dataCollectorDefinition->addArgument(array_map(function ($loggerId) : Reference { |
|
233 | + $dataCollectorDefinition->addArgument(array_map(function($loggerId) : Reference { |
|
234 | 234 | return new Reference($loggerId); |
235 | 235 | }, array_keys($container->findTaggedServiceIds('eight_points_guzzle.logger')))); |
236 | 236 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | ->scalarNode('base_url') |
97 | 97 | ->defaultValue(null) |
98 | 98 | ->validate() |
99 | - ->ifTrue(function ($v) { |
|
99 | + ->ifTrue(function($v) { |
|
100 | 100 | return !is_string($v); |
101 | 101 | }) |
102 | 102 | ->thenInvalid('base_url can be: string') |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | ->integerNode('logging') |
107 | 107 | ->defaultValue(null) |
108 | 108 | ->beforeNormalization() |
109 | - ->always(function ($value): int { |
|
109 | + ->always(function($value): int { |
|
110 | 110 | if ($value === 1 || $value === true) { |
111 | 111 | return Logger::LOG_MODE_REQUEST_AND_RESPONSE; |
112 | 112 | } elseif ($value === 0 || $value === false) { |
113 | 113 | return Logger::LOG_MODE_NONE; |
114 | 114 | } else { |
115 | - return constant(Logger::class .'::LOG_MODE_' . strtoupper($value)); |
|
115 | + return constant(Logger::class.'::LOG_MODE_'.strtoupper($value)); |
|
116 | 116 | } |
117 | 117 | }) |
118 | 118 | ->end() |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ->scalarNode('handler') |
121 | 121 | ->defaultValue(null) |
122 | 122 | ->validate() |
123 | - ->ifTrue(function ($v) { |
|
123 | + ->ifTrue(function($v) { |
|
124 | 124 | return $v !== null && (!is_string($v) || !class_exists($v)); |
125 | 125 | }) |
126 | 126 | ->thenInvalid('handler must be a valid FQCN for a loaded class') |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | ->end() |
129 | 129 | ->arrayNode('options') |
130 | 130 | ->validate() |
131 | - ->ifTrue(function ($options) { |
|
131 | + ->ifTrue(function($options) { |
|
132 | 132 | return count($options['form_params']) && count($options['multipart']); |
133 | 133 | }) |
134 | 134 | ->thenInvalid('You cannot use form_params and multipart at the same time.') |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ->end() |
142 | 142 | ->variableNode('allow_redirects') |
143 | 143 | ->validate() |
144 | - ->ifTrue(function ($v) { |
|
144 | + ->ifTrue(function($v) { |
|
145 | 145 | return !is_array($v) && !is_bool($v); |
146 | 146 | }) |
147 | 147 | ->thenInvalid('allow_redirects can be: bool or array') |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ->end() |
150 | 150 | ->variableNode('auth') |
151 | 151 | ->validate() |
152 | - ->ifTrue(function ($v) { |
|
152 | + ->ifTrue(function($v) { |
|
153 | 153 | return !is_array($v) && !is_string($v); |
154 | 154 | }) |
155 | 155 | ->thenInvalid('auth can be: string or array') |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ->end() |
158 | 158 | ->variableNode('query') |
159 | 159 | ->validate() |
160 | - ->ifTrue(function ($v) { |
|
160 | + ->ifTrue(function($v) { |
|
161 | 161 | return !is_string($v) && !is_array($v); |
162 | 162 | }) |
163 | 163 | ->thenInvalid('query can be: string or array') |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | ->arrayNode('curl') |
167 | 167 | ->beforeNormalization() |
168 | 168 | ->ifArray() |
169 | - ->then(function (array $curlOptions) { |
|
169 | + ->then(function(array $curlOptions) { |
|
170 | 170 | $result = []; |
171 | 171 | |
172 | 172 | foreach ($curlOptions as $key => $value) { |
173 | - $optionName = 'CURLOPT_' . strtoupper($key); |
|
173 | + $optionName = 'CURLOPT_'.strtoupper($key); |
|
174 | 174 | |
175 | 175 | if (!defined($optionName)) { |
176 | 176 | throw new InvalidConfigurationException(sprintf( |
177 | - 'Invalid curl option in eight_points_guzzle: %s. ' . |
|
178 | - 'Ex: use sslversion for CURLOPT_SSLVERSION option. ' . PHP_EOL . |
|
177 | + 'Invalid curl option in eight_points_guzzle: %s. '. |
|
178 | + 'Ex: use sslversion for CURLOPT_SSLVERSION option. '.PHP_EOL. |
|
179 | 179 | 'See all available options: http://php.net/manual/en/function.curl-setopt.php', |
180 | 180 | $key |
181 | 181 | )); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | ->end() |
193 | 193 | ->variableNode('cert') |
194 | 194 | ->validate() |
195 | - ->ifTrue(function ($v) { |
|
195 | + ->ifTrue(function($v) { |
|
196 | 196 | return !is_string($v) && (!is_array($v) || count($v) !== 2); |
197 | 197 | }) |
198 | 198 | ->thenInvalid('cert can be: string or array with two entries (path and password)') |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | ->end() |
201 | 201 | ->scalarNode('connect_timeout') |
202 | 202 | ->beforeNormalization() |
203 | - ->always(function ($v) { |
|
203 | + ->always(function($v) { |
|
204 | 204 | return is_numeric($v) ? (float) $v : $v; |
205 | 205 | }) |
206 | 206 | ->end() |
207 | 207 | ->validate() |
208 | - ->ifTrue(function ($v) { |
|
208 | + ->ifTrue(function($v) { |
|
209 | 209 | return !is_float($v) && !(is_string($v) && strpos($v, 'env_') === 0); |
210 | 210 | }) |
211 | 211 | ->thenInvalid('connect_timeout can be: float') |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ->booleanNode('debug')->end() |
215 | 215 | ->variableNode('decode_content') |
216 | 216 | ->validate() |
217 | - ->ifTrue(function ($v) { |
|
217 | + ->ifTrue(function($v) { |
|
218 | 218 | return !is_string($v) && !is_bool($v); |
219 | 219 | }) |
220 | 220 | ->thenInvalid('decode_content can be: bool or string (gzip, compress, deflate, etc...)') |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | ->end() |
231 | 231 | ->scalarNode('sink') |
232 | 232 | ->validate() |
233 | - ->ifTrue(function ($v) { |
|
233 | + ->ifTrue(function($v) { |
|
234 | 234 | return !is_string($v); |
235 | 235 | }) |
236 | 236 | ->thenInvalid('sink can be: string') |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | ->booleanNode('http_errors')->end() |
240 | 240 | ->variableNode('expect') |
241 | 241 | ->validate() |
242 | - ->ifTrue(function ($v) { |
|
242 | + ->ifTrue(function($v) { |
|
243 | 243 | return !is_bool($v) && !is_int($v); |
244 | 244 | }) |
245 | 245 | ->thenInvalid('expect can be: bool or int') |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ->end() |
248 | 248 | ->variableNode('ssl_key') |
249 | 249 | ->validate() |
250 | - ->ifTrue(function ($v) { |
|
250 | + ->ifTrue(function($v) { |
|
251 | 251 | return !is_string($v) && (!is_array($v) || count($v) !== 2); |
252 | 252 | }) |
253 | 253 | ->thenInvalid('ssl_key can be: string or array with two entries (path and password)') |
@@ -257,12 +257,12 @@ discard block |
||
257 | 257 | ->booleanNode('synchronous')->end() |
258 | 258 | ->scalarNode('read_timeout') |
259 | 259 | ->beforeNormalization() |
260 | - ->always(function ($v) { |
|
260 | + ->always(function($v) { |
|
261 | 261 | return is_numeric($v) ? (float) $v : $v; |
262 | 262 | }) |
263 | 263 | ->end() |
264 | 264 | ->validate() |
265 | - ->ifTrue(function ($v) { |
|
265 | + ->ifTrue(function($v) { |
|
266 | 266 | return !is_float($v) && !(is_string($v) && strpos($v, 'env_') === 0); |
267 | 267 | }) |
268 | 268 | ->thenInvalid('read_timeout can be: float') |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | ->end() |
271 | 271 | ->scalarNode('timeout') |
272 | 272 | ->beforeNormalization() |
273 | - ->always(function ($v) { |
|
273 | + ->always(function($v) { |
|
274 | 274 | return is_numeric($v) ? (float) $v : $v; |
275 | 275 | }) |
276 | 276 | ->end() |
277 | 277 | ->validate() |
278 | - ->ifTrue(function ($v) { |
|
278 | + ->ifTrue(function($v) { |
|
279 | 279 | return !is_float($v) && !(is_string($v) && strpos($v, 'env_') === 0); |
280 | 280 | }) |
281 | 281 | ->thenInvalid('timeout can be: float') |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | ->end() |
284 | 284 | ->variableNode('verify') |
285 | 285 | ->validate() |
286 | - ->ifTrue(function ($v) { |
|
286 | + ->ifTrue(function($v) { |
|
287 | 287 | return !is_bool($v) && !is_string($v); |
288 | 288 | }) |
289 | 289 | ->thenInvalid('verify can be: bool or string') |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | ->end() |
314 | 314 | ->scalarNode('version') |
315 | 315 | ->validate() |
316 | - ->ifTrue(function ($v) { |
|
316 | + ->ifTrue(function($v) { |
|
317 | 317 | return !is_string($v) && !is_float($v); |
318 | 318 | }) |
319 | 319 | ->thenInvalid('version can be: string or float') |