@@ -78,7 +78,7 @@ |
||
| 78 | 78 | ); |
| 79 | 79 | $this->validateExpectationOrThrowException($expectation, $this->logger); |
| 80 | 80 | |
| 81 | - $this->logger->debug('Parsed expectation: ' . var_export($expectation, true)); |
|
| 81 | + $this->logger->debug('Parsed expectation: '.var_export($expectation, true)); |
|
| 82 | 82 | $this->storage->addExpectation($expectation); |
| 83 | 83 | // As we have no API to modify expectation parsed the same object could be used for backup. |
| 84 | 84 | // On futher changes when $expectation modifications are possible something like deep-copy |
@@ -148,9 +148,9 @@ |
||
| 148 | 148 | { |
| 149 | 149 | $path = ltrim($httpRequest->getUri()->getPath(), '/'); |
| 150 | 150 | $query = $httpRequest->getUri()->getQuery(); |
| 151 | - $return = '/' . $path; |
|
| 151 | + $return = '/'.$path; |
|
| 152 | 152 | if ($query) { |
| 153 | - $return .= '?' . $httpRequest->getUri()->getQuery(); |
|
| 153 | + $return .= '?'.$httpRequest->getUri()->getQuery(); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $return; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | public function createResponse(Expectation $expectation, TransactionData $transactionData) |
| 50 | 50 | { |
| 51 | 51 | $url = $expectation->getProxyTo(); |
| 52 | - $this->logger->debug('Proxying request to : ' . $url); |
|
| 52 | + $this->logger->debug('Proxying request to : '.$url); |
|
| 53 | 53 | |
| 54 | 54 | return $this->httpService->send( |
| 55 | 55 | $transactionData->getRequest()->withUri(new Uri($url)) |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | if ($responseConfig->getDelayMillis()) { |
| 40 | 40 | $this->logger->debug( |
| 41 | - 'Delaying the response for ' . $responseConfig->getDelayMillis() . ' milliseconds' |
|
| 41 | + 'Delaying the response for '.$responseConfig->getDelayMillis().' milliseconds' |
|
| 42 | 42 | ); |
| 43 | 43 | usleep($responseConfig->getDelayMillis() * 1000); |
| 44 | 44 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | |
| 41 | 41 | $windowsHome = getenv('HOMEPATH'); |
| 42 | 42 | if (!empty($windowsHome)) { |
| 43 | - return getenv('HOMEDRIVE') . getenv('HOMEPATH'); |
|
| 43 | + return getenv('HOMEDRIVE').getenv('HOMEPATH'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | throw new \Exception('Could not get the users\'s home path'); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $decodedValue = json_decode($value, true); |
| 66 | 66 | if (JSON_ERROR_NONE !== json_last_error()) { |
| 67 | - throw new \InvalidArgumentException('JSON parsing error: ' . json_last_error_msg()); |
|
| 67 | + throw new \InvalidArgumentException('JSON parsing error: '.json_last_error_msg()); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return $decodedValue; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $requestValue = $this->decodeJson($value); |
| 82 | 82 | } catch (\InvalidArgumentException $e) { |
| 83 | 83 | $requestValue = $value; |
| 84 | - $this->logger->warning('Invalid json received in request: ' . $value); |
|
| 84 | + $this->logger->warning('Invalid json received in request: '.$value); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | return $requestValue; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $serverClass = $this->getReactServerClass(); |
| 83 | 83 | $this->http = new $serverClass( |
| 84 | - function (ServerRequestInterface $request) { |
|
| 84 | + function(ServerRequestInterface $request) { |
|
| 85 | 85 | return $this->createRequestManager($request); |
| 86 | 86 | } |
| 87 | 87 | ); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // Dispatch pending signals periodically |
| 94 | 94 | if (\function_exists('pcntl_signal_dispatch')) { |
| 95 | - $this->loop->addPeriodicTimer(0.5, function () { |
|
| 95 | + $this->loop->addPeriodicTimer(0.5, function() { |
|
| 96 | 96 | pcntl_signal_dispatch(); |
| 97 | 97 | }); |
| 98 | 98 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $start = microtime(true); |
| 122 | 122 | $psrResponse = $this->requestHandler->execute($request, new PsrResponse()); |
| 123 | - $this->logger->debug('Processing took ' . number_format((microtime(true) - $start) * 1000, 3) . ' milliseconds'); |
|
| 123 | + $this->logger->debug('Processing took '.number_format((microtime(true) - $start) * 1000, 3).' milliseconds'); |
|
| 124 | 124 | |
| 125 | 125 | return $psrResponse; |
| 126 | 126 | } |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | private function createRequestManager(ServerRequestInterface $request) |
| 132 | 132 | { |
| 133 | - return new Promise(function ($resolve, $reject) use ($request) { |
|
| 133 | + return new Promise(function($resolve, $reject) use ($request) { |
|
| 134 | 134 | $bodyStream = ''; |
| 135 | 135 | |
| 136 | - $request->getBody()->on('data', function ($data) use (&$bodyStream, $request) { |
|
| 136 | + $request->getBody()->on('data', function($data) use (&$bodyStream, $request) { |
|
| 137 | 137 | $bodyStream .= $data; |
| 138 | 138 | }); |
| 139 | - $request->getBody()->on('end', function () use ($resolve, $request, &$bodyStream) { |
|
| 139 | + $request->getBody()->on('end', function() use ($resolve, $request, &$bodyStream) { |
|
| 140 | 140 | $response = $this->onRequest($request->withBody(new StringStream($bodyStream))); |
| 141 | 141 | $resolve($response); |
| 142 | 142 | }); |
| 143 | - $request->getBody()->on('error', function (\Exception $exception) use ($resolve) { |
|
| 143 | + $request->getBody()->on('error', function(\Exception $exception) use ($resolve) { |
|
| 144 | 144 | $response = new ReactResponse( |
| 145 | 145 | 400, |
| 146 | 146 | ['Content-Type' => 'text/plain'], |
| 147 | - 'An error occured while reading: ' . $exception->getMessage() |
|
| 147 | + 'An error occured while reading: '.$exception->getMessage() |
|
| 148 | 148 | ); |
| 149 | 149 | $resolve($response); |
| 150 | 150 | }); |
@@ -33,10 +33,10 @@ |
||
| 33 | 33 | $url = $request->getUri(); |
| 34 | 34 | $return = $url->getPath(); |
| 35 | 35 | if ($url->getQuery()) { |
| 36 | - $return .= '?' . $url->getQuery(); |
|
| 36 | + $return .= '?'.$url->getQuery(); |
|
| 37 | 37 | } |
| 38 | 38 | if ($url->getFragment()) { |
| 39 | - $return .= '#' . $url->getFragment(); |
|
| 39 | + $return .= '#'.$url->getFragment(); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | return $return; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | private function validateMatcherOrThrowException($matcher) |
| 65 | 65 | { |
| 66 | 66 | if (!Matchers::isValidMatcher($matcher)) { |
| 67 | - throw new FilterErrorException('Invalid condition matcher specified: ' . $matcher); |
|
| 67 | + throw new FilterErrorException('Invalid condition matcher specified: '.$matcher); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | private function checkValueIsValidOrThrowException($value) |
| 77 | 77 | { |
| 78 | 78 | if (!\is_array($value) || 1 !== \count($value)) { |
| 79 | - throw new FilterErrorException('Condition parsing failed for "' . var_export($value, true) . '", it should be something like: "isEqualTo" : "a value"'); |
|
| 79 | + throw new FilterErrorException('Condition parsing failed for "'.var_export($value, true).'", it should be something like: "isEqualTo" : "a value"'); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |