@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * Transform command to request. |
| 33 | 33 | * |
| 34 | - * @return Request |
|
| 34 | + * @return \Closure |
|
| 35 | 35 | */ |
| 36 | 36 | public function commandToRequestTransformer() |
| 37 | 37 | { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Transform response to result. |
| 87 | 87 | * |
| 88 | - * @return Result |
|
| 88 | + * @return \Closure |
|
| 89 | 89 | */ |
| 90 | 90 | public function responseToResultTransformer() |
| 91 | 91 | { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function commandToRequestTransformer() |
| 37 | 37 | { |
| 38 | - return function (CommandInterface $command) { |
|
| 38 | + return function(CommandInterface $command) { |
|
| 39 | 39 | if (!$this->service->hasOperation($command->getName())) { |
| 40 | 40 | throw new CommandException(sprintf( |
| 41 | 41 | 'Command "%s" not found', |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function responseToResultTransformer() |
| 91 | 91 | { |
| 92 | - return function ( |
|
| 92 | + return function( |
|
| 93 | 93 | ResponseInterface $response, |
| 94 | 94 | RequestInterface $request, |
| 95 | 95 | CommandInterface $command |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | public function badResponseExceptionParser() |
| 116 | 116 | { |
| 117 | - return function (CommandInterface $command, GuzzleBadResponseException $e) { |
|
| 117 | + return function(CommandInterface $command, GuzzleBadResponseException $e) { |
|
| 118 | 118 | $operation = $this->service->getOperation($command->getName()); |
| 119 | 119 | |
| 120 | 120 | return $this->processResponseError( |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | // if no ifCode property then return exception |
| 174 | 174 | if (!$error['ifCode']) { |
| 175 | - $responseMessage = $this->getErrorMessage($body, $error,$response); |
|
| 175 | + $responseMessage = $this->getErrorMessage($body, $error, $response); |
|
| 176 | 176 | |
| 177 | 177 | return new BadResponseException( |
| 178 | 178 | $responseCode, |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if ($error['ifCode'] == $responseCode) { |
| 191 | - $responseMessage = $this->getErrorMessage($body, $error,$response); |
|
| 191 | + $responseMessage = $this->getErrorMessage($body, $error, $response); |
|
| 192 | 192 | |
| 193 | 193 | return new BadResponseException( |
| 194 | 194 | $responseCode, |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | /** |
| 128 | 128 | * Create ValidatorException. |
| 129 | 129 | * |
| 130 | - * @return ValidationException |
|
| 130 | + * @return ValidatorException |
|
| 131 | 131 | */ |
| 132 | 132 | public function createValidatorException() |
| 133 | 133 | { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | $rootNode |
| 24 | 24 | ->validate() |
| 25 | - ->always(function ($v) { |
|
| 25 | + ->always(function($v) { |
|
| 26 | 26 | foreach ($v['operations'] as $name => $operation) { |
| 27 | 27 | if (!$operation['requestProtocol']) { |
| 28 | 28 | $v['operations'][$name]['requestProtocol'] = $v['protocol']; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | ->isRequired() |
| 122 | 122 | ->beforeNormalization() |
| 123 | 123 | ->ifString() |
| 124 | - ->then(function ($v) { |
|
| 124 | + ->then(function($v) { |
|
| 125 | 125 | return strtoupper($v); |
| 126 | 126 | }) |
| 127 | 127 | ->end() |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ->cannotBeEmpty() |
| 136 | 136 | ->validate() |
| 137 | 137 | ->ifString() |
| 138 | - ->then(function ($v) { |
|
| 138 | + ->then(function($v) { |
|
| 139 | 139 | return '/'.ltrim($v, '/'); |
| 140 | 140 | }) |
| 141 | 141 | ->end() |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | $rootNode |
| 226 | 226 | ->beforeNormalization() |
| 227 | - ->always(function ($v) use ($fromOperation) { |
|
| 227 | + ->always(function($v) use ($fromOperation) { |
|
| 228 | 228 | if (!$fromOperation) { |
| 229 | 229 | if (isset($v['shape'])) { |
| 230 | 230 | throw new InvalidSpecificationException('Unrecognized option "shape"'); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | ->arrayNode('members') |
| 259 | 259 | ->beforeNormalization() |
| 260 | 260 | ->ifArray() |
| 261 | - ->then(function ($v) { |
|
| 261 | + ->then(function($v) { |
|
| 262 | 262 | foreach ($v as $name => $member) { |
| 263 | 263 | if (!isset($member['locationName'])) { |
| 264 | 264 | $v[$name]['locationName'] = $name; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | { |
| 339 | 339 | $rootNode |
| 340 | 340 | ->beforeNormalization() |
| 341 | - ->always(function ($v) use ($fromOperation) { |
|
| 341 | + ->always(function($v) use ($fromOperation) { |
|
| 342 | 342 | if (!$fromOperation) { |
| 343 | 343 | if (isset($v['errorShape'])) { |
| 344 | 344 | throw new InvalidSpecificationException('Unrecognized option "errorShape"'); |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | // Modify provided callbacks to track results. |
| 119 | 119 | $results = []; |
| 120 | - $options['fulfilled'] = function ($v, $k) use (&$results, $options) { |
|
| 120 | + $options['fulfilled'] = function($v, $k) use (&$results, $options) { |
|
| 121 | 121 | if (isset($options['fulfilled'])) { |
| 122 | 122 | $options['fulfilled']($v, $k); |
| 123 | 123 | } |
| 124 | 124 | $results[$k] = $v; |
| 125 | 125 | }; |
| 126 | - $options['rejected'] = function ($v, $k) use (&$results, $options) { |
|
| 126 | + $options['rejected'] = function($v, $k) use (&$results, $options) { |
|
| 127 | 127 | if (isset($options['rejected'])) { |
| 128 | 128 | $options['rejected']($v, $k); |
| 129 | 129 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | // Execute multiple commands synchronously, then sort and return the results. |
| 134 | 134 | return $this->executeAllAsync($commands, $options) |
| 135 | - ->then(function () use (&$results) { |
|
| 135 | + ->then(function() use (&$results) { |
|
| 136 | 136 | ksort($results); |
| 137 | 137 | |
| 138 | 138 | return $results; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | // Convert the iterator of commands to a generator of promises. |
| 154 | 154 | $commands = Promise\iter_for($commands); |
| 155 | - $promises = function () use ($commands) { |
|
| 155 | + $promises = function() use ($commands) { |
|
| 156 | 156 | foreach ($commands as $key => $command) { |
| 157 | 157 | if (!$command instanceof CommandInterface) { |
| 158 | 158 | throw new \InvalidArgumentException('The iterator must ' |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | private function createCommandHandler() |
| 197 | 197 | { |
| 198 | - return function (CommandInterface $command) { |
|
| 199 | - return Promise\coroutine(function () use ($command) { |
|
| 198 | + return function(CommandInterface $command) { |
|
| 199 | + return Promise\coroutine(function() use ($command) { |
|
| 200 | 200 | // Prepare the HTTP options. |
| 201 | 201 | $opts = $command['@http'] ?: []; |
| 202 | 202 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!($loader = @include __DIR__ . '/../vendor/autoload.php')) { |
|
| 3 | +if (!($loader = @include __DIR__.'/../vendor/autoload.php')) { |
|
| 4 | 4 | echo <<<EOT |
| 5 | 5 | You need to install the project dependencies using Composer: |
| 6 | 6 | $ wget http://getcomposer.org/composer.phar |