| @@ -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']); | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 |                      ->scalarNode('base_url') | 
| 84 | 84 | ->defaultValue(null) | 
| 85 | 85 | ->validate() | 
| 86 | -                            ->ifTrue(function ($v) { | |
| 86 | +                            ->ifTrue(function($v) { | |
| 87 | 87 | return !is_string($v); | 
| 88 | 88 | }) | 
| 89 | 89 |                              ->thenInvalid('base_url can be: string') | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | ->end() | 
| 92 | 92 |                      ->arrayNode('options') | 
| 93 | 93 | ->validate() | 
| 94 | -                            ->ifTrue(function ($options) { | |
| 94 | +                            ->ifTrue(function($options) { | |
| 95 | 95 | return count($options['form_params']) && count($options['multipart']); | 
| 96 | 96 | }) | 
| 97 | 97 |                              ->thenInvalid('You cannot use form_params and multipart at the same time.') | 
| @@ -104,7 +104,7 @@ discard block | ||
| 104 | 104 | ->end() | 
| 105 | 105 |                              ->variableNode('allow_redirects') | 
| 106 | 106 | ->validate() | 
| 107 | -                                    ->ifTrue(function ($v) { | |
| 107 | +                                    ->ifTrue(function($v) { | |
| 108 | 108 | return !is_array($v) && !is_bool($v); | 
| 109 | 109 | }) | 
| 110 | 110 |                                      ->thenInvalid('allow_redirects can be: bool or array') | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | ->end() | 
| 113 | 113 |                              ->variableNode('auth') | 
| 114 | 114 | ->validate() | 
| 115 | -                                    ->ifTrue(function ($v) { | |
| 115 | +                                    ->ifTrue(function($v) { | |
| 116 | 116 | return !is_array($v) && !is_string($v); | 
| 117 | 117 | }) | 
| 118 | 118 |                                      ->thenInvalid('auth can be: string or array') | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | ->end() | 
| 121 | 121 |                              ->variableNode('query') | 
| 122 | 122 | ->validate() | 
| 123 | -                                    ->ifTrue(function ($v) { | |
| 123 | +                                    ->ifTrue(function($v) { | |
| 124 | 124 | return !is_string($v) && !is_array($v); | 
| 125 | 125 | }) | 
| 126 | 126 |                                      ->thenInvalid('query can be: string or array') | 
| @@ -129,16 +129,16 @@ discard block | ||
| 129 | 129 |                              ->arrayNode('curl') | 
| 130 | 130 | ->beforeNormalization() | 
| 131 | 131 | ->ifArray() | 
| 132 | -                                        ->then(function (array $curlOptions) { | |
| 132 | +                                        ->then(function(array $curlOptions) { | |
| 133 | 133 | $result = []; | 
| 134 | 134 | |
| 135 | 135 |                                              foreach ($curlOptions as $key => $value) { | 
| 136 | - $optionName = 'CURLOPT_' . strtoupper($key); | |
| 136 | + $optionName = 'CURLOPT_'.strtoupper($key); | |
| 137 | 137 | |
| 138 | 138 |                                                  if (!defined($optionName)) { | 
| 139 | 139 | throw new InvalidConfigurationException(sprintf( | 
| 140 | - 'Invalid curl option in eight_points_guzzle: %s. ' . | |
| 141 | - 'Ex: use sslversion for CURLOPT_SSLVERSION option. ' . PHP_EOL . | |
| 140 | + 'Invalid curl option in eight_points_guzzle: %s. '. | |
| 141 | + 'Ex: use sslversion for CURLOPT_SSLVERSION option. '.PHP_EOL. | |
| 142 | 142 | 'See all available options: http://php.net/manual/en/function.curl-setopt.php', | 
| 143 | 143 | $key | 
| 144 | 144 | )); | 
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 | ->end() | 
| 156 | 156 |                              ->variableNode('cert') | 
| 157 | 157 | ->validate() | 
| 158 | -                                    ->ifTrue(function ($v) { | |
| 158 | +                                    ->ifTrue(function($v) { | |
| 159 | 159 | return !is_string($v) && (!is_array($v) || count($v) !== 2); | 
| 160 | 160 | }) | 
| 161 | 161 |                                      ->thenInvalid('cert can be: string or array with two entries (path and password)') | 
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 |                              ->booleanNode('debug')->end() | 
| 166 | 166 |                              ->variableNode('decode_content') | 
| 167 | 167 | ->validate() | 
| 168 | -                                    ->ifTrue(function ($v) { | |
| 168 | +                                    ->ifTrue(function($v) { | |
| 169 | 169 | return !is_string($v) && !is_bool($v); | 
| 170 | 170 | }) | 
| 171 | 171 |                                      ->thenInvalid('decode_content can be: bool or string (gzip, compress, deflate, etc...)') | 
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | ->end() | 
| 183 | 183 |                              ->scalarNode('sink') | 
| 184 | 184 | ->validate() | 
| 185 | -                                    ->ifTrue(function ($v) { | |
| 185 | +                                    ->ifTrue(function($v) { | |
| 186 | 186 | return !is_string($v); | 
| 187 | 187 | }) | 
| 188 | 188 |                                      ->thenInvalid('sink can be: string') | 
| @@ -191,7 +191,7 @@ discard block | ||
| 191 | 191 |                              ->booleanNode('http_errors')->end() | 
| 192 | 192 |                              ->variableNode('expect') | 
| 193 | 193 | ->validate() | 
| 194 | -                                    ->ifTrue(function ($v) { | |
| 194 | +                                    ->ifTrue(function($v) { | |
| 195 | 195 | return !is_bool($v) && !is_int($v); | 
| 196 | 196 | }) | 
| 197 | 197 |                                      ->thenInvalid('expect can be: bool or int') | 
| @@ -199,7 +199,7 @@ discard block | ||
| 199 | 199 | ->end() | 
| 200 | 200 |                              ->variableNode('ssl_key') | 
| 201 | 201 | ->validate() | 
| 202 | -                                    ->ifTrue(function ($v) { | |
| 202 | +                                    ->ifTrue(function($v) { | |
| 203 | 203 | return !is_string($v) && (!is_array($v) || count($v) !== 2); | 
| 204 | 204 | }) | 
| 205 | 205 |                                      ->thenInvalid('ssl_key can be: string or array with two entries (path and password)') | 
| @@ -210,7 +210,7 @@ discard block | ||
| 210 | 210 |                              ->floatNode('timeout')->end() | 
| 211 | 211 |                              ->variableNode('verify') | 
| 212 | 212 | ->validate() | 
| 213 | -                                    ->ifTrue(function ($v) { | |
| 213 | +                                    ->ifTrue(function($v) { | |
| 214 | 214 | return !is_bool($v) && !is_string($v); | 
| 215 | 215 | }) | 
| 216 | 216 |                                      ->thenInvalid('verify can be: bool or string') | 
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 | ->end() | 
| 241 | 241 |                              ->scalarNode('version') | 
| 242 | 242 | ->validate() | 
| 243 | -                                    ->ifTrue(function ($v) { | |
| 243 | +                                    ->ifTrue(function($v) { | |
| 244 | 244 | return !is_string($v) && !is_float($v); | 
| 245 | 245 | }) | 
| 246 | 246 |                                      ->thenInvalid('version can be: string or float') | 
| @@ -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 | |