@@ -60,10 +60,10 @@ |
||
60 | 60 | $transactionData->setResponse( |
61 | 61 | $this->processAndGetResponse( |
62 | 62 | $transactionData, |
63 | - function (TransactionData $transaction, Expectation $expectation) { |
|
63 | + function(TransactionData $transaction, Expectation $expectation) { |
|
64 | 64 | $this->validateRequestOrThrowException($expectation, $this->logger); |
65 | 65 | $count = $this->searchForExecutionsCount($expectation); |
66 | - $this->logger->debug('Found ' . $count . ' request matching the expectation'); |
|
66 | + $this->logger->debug('Found '.$count.' request matching the expectation'); |
|
67 | 67 | |
68 | 68 | return $transaction->getResponse() |
69 | 69 | ->withStatus(200) |
@@ -60,10 +60,10 @@ |
||
60 | 60 | $transactionData->setResponse( |
61 | 61 | $this->processAndGetResponse( |
62 | 62 | $transactionData, |
63 | - function (TransactionData $transaction, Expectation $expectation) { |
|
63 | + function(TransactionData $transaction, Expectation $expectation) { |
|
64 | 64 | $this->validateRequestOrThrowException($expectation, $this->logger); |
65 | 65 | $executions = $this->searchForExecutionsCount($expectation); |
66 | - $this->logger->debug('Listed ' . \count($executions) . ' request matching the expectation'); |
|
66 | + $this->logger->debug('Listed '.\count($executions).' request matching the expectation'); |
|
67 | 67 | |
68 | 68 | return $transaction->getResponse() |
69 | 69 | ->withStatus(200) |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | return $this->constructErrorResponse($e->getErrors(), $transactionData->getResponse()); |
99 | 99 | } catch (\Exception $e) { |
100 | - $this->logger->error('An unexpected exception occurred: ' . $e->getMessage()); |
|
100 | + $this->logger->error('An unexpected exception occurred: '.$e->getMessage()); |
|
101 | 101 | $this->logger->debug($e->__toString()); |
102 | 102 | |
103 | 103 | return $this->constructErrorResponse([$e->getMessage()], $transactionData->getResponse()); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | Expectation::class, |
116 | 116 | RequestBuilder::RETURN_ALL_ERRORS_IN_EXCEPTION |
117 | 117 | ); |
118 | - $this->logger->debug('Parsed expectation: ' . $object); |
|
118 | + $this->logger->debug('Parsed expectation: '.$object); |
|
119 | 119 | |
120 | 120 | return $object; |
121 | 121 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $this->logger->debug('Searching matching expectation for request'); |
62 | 62 | $request = $transactionData->getRequest(); |
63 | - $this->logger->info('Request received: ' . $this->getLoggableRequest($request)); |
|
63 | + $this->logger->info('Request received: '.$this->getLoggableRequest($request)); |
|
64 | 64 | $foundExpectation = $this->searchForMatchingExpectation($request); |
65 | 65 | if (null === $foundExpectation) { |
66 | 66 | $transactionData->set('foundExpectation', false); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function getLoggableRequest(ServerRequestInterface $request) |
106 | 106 | { |
107 | - return $request->getMethod() . ': ' |
|
108 | - . $request->getUri()->__toString() . ' || ' |
|
107 | + return $request->getMethod().': ' |
|
108 | + . $request->getUri()->__toString().' || ' |
|
109 | 109 | . preg_replace('|\s+|', ' ', $request->getBody()->__toString()); |
110 | 110 | } |
111 | 111 | } |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | $transactionData->setResponse( |
55 | 55 | $this->processAndGetResponse( |
56 | 56 | $transactionData, |
57 | - function (TransactionData $transaction, ScenarioState $state) { |
|
57 | + function(TransactionData $transaction, ScenarioState $state) { |
|
58 | 58 | $this->storage->setScenarioState($state->getScenarioName(), $state->getScenarioState()); |
59 | 59 | $this->logger->debug( |
60 | - 'Scenario ' . $state->getScenarioName() . ' state is set to ' . $state->getScenarioState() |
|
60 | + 'Scenario '.$state->getScenarioName().' state is set to '.$state->getScenarioState() |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | return $transaction->getResponse() |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ScenarioState::class, |
83 | 83 | RequestBuilder::RETURN_ALL_ERRORS_IN_EXCEPTION |
84 | 84 | ); |
85 | - $this->logger->debug('Parsed scenario state: ' . var_export($object, true)); |
|
85 | + $this->logger->debug('Parsed scenario state: '.var_export($object, true)); |
|
86 | 86 | |
87 | 87 | return $object; |
88 | 88 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $transactionData->setResponse( |
56 | 56 | $this->processAndGetResponse( |
57 | 57 | $transactionData, |
58 | - function (TransactionData $transaction, Expectation $expectation) { |
|
58 | + function(TransactionData $transaction, Expectation $expectation) { |
|
59 | 59 | $this->validateExpectationOrThrowException($expectation, $this->logger); |
60 | 60 | $this->storage->addExpectation($expectation); |
61 | 61 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | try { |
53 | 53 | return $this->router->start($request, $response); |
54 | 54 | } catch (\Exception $e) { |
55 | - $this->logger->warning('Unexpected exception: ' . $e->getMessage()); |
|
55 | + $this->logger->warning('Unexpected exception: '.$e->getMessage()); |
|
56 | 56 | $this->logger->debug($e->__toString()); |
57 | 57 | |
58 | 58 | return $response->withStatus(500) |
@@ -27,6 +27,6 @@ |
||
27 | 27 | */ |
28 | 28 | public static function init() |
29 | 29 | { |
30 | - return require __DIR__ . '/dependencies-setup.php'; |
|
30 | + return require __DIR__.'/dependencies-setup.php'; |
|
31 | 31 | } |
32 | 32 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $di = new DependencyInjectionService(); |
53 | 53 | |
54 | -$di->register('logger', function () { |
|
54 | +$di->register('logger', function() { |
|
55 | 55 | // create a log channel |
56 | 56 | $log = new Logger('stdoutLogger'); |
57 | 57 | $log->pushHandler(new StreamHandler(STDOUT, LOG_LEVEL)); |
@@ -59,64 +59,64 @@ discard block |
||
59 | 59 | return $log; |
60 | 60 | }); |
61 | 61 | |
62 | -$di->register(RemoteConnectionInterface::class, function () { |
|
62 | +$di->register(RemoteConnectionInterface::class, function() { |
|
63 | 63 | return new GuzzleConnection(new GuzzleHttp\Client()); |
64 | 64 | }); |
65 | 65 | |
66 | -$di->register(HttpResponseStrategy::class, function () use ($di) { |
|
66 | +$di->register(HttpResponseStrategy::class, function() use ($di) { |
|
67 | 67 | return new HttpResponseStrategy($di->get('logger')); |
68 | 68 | }); |
69 | 69 | |
70 | -$di->register(RegexResponseStrategy::class, function () use ($di) { |
|
70 | +$di->register(RegexResponseStrategy::class, function() use ($di) { |
|
71 | 71 | return new RegexResponseStrategy($di->get('logger')); |
72 | 72 | }); |
73 | 73 | |
74 | -$di->register(ProxyResponseStrategy::class, function () use ($di) { |
|
74 | +$di->register(ProxyResponseStrategy::class, function() use ($di) { |
|
75 | 75 | return new ProxyResponseStrategy( |
76 | 76 | $di->get(RemoteConnectionInterface::class), |
77 | 77 | $di->get('logger') |
78 | 78 | ); |
79 | 79 | }); |
80 | 80 | |
81 | -$di->register('responseStrategyFactory', function () use ($di) { |
|
81 | +$di->register('responseStrategyFactory', function() use ($di) { |
|
82 | 82 | return new ResponseStrategyLocator($di); |
83 | 83 | }); |
84 | 84 | |
85 | -$di->register('config', function () { |
|
85 | +$di->register('config', function() { |
|
86 | 86 | return RouterConfig::get(); |
87 | 87 | }); |
88 | 88 | |
89 | -$di->register('homePathService', function () { |
|
89 | +$di->register('homePathService', function() { |
|
90 | 90 | return new HomePathService(); |
91 | 91 | }); |
92 | 92 | |
93 | -$di->register('server', function () use ($di) { |
|
93 | +$di->register('server', function() use ($di) { |
|
94 | 94 | $server = new ReactPhpServer($di->get('logger')); |
95 | 95 | |
96 | 96 | return $server; |
97 | 97 | }); |
98 | 98 | |
99 | -$di->register('application', function () use ($di) { |
|
99 | +$di->register('application', function() use ($di) { |
|
100 | 100 | return new Phiremock($di->get('router'), $di->get('logger')); |
101 | 101 | }); |
102 | 102 | |
103 | -$di->register('expectationStorage', function () { |
|
103 | +$di->register('expectationStorage', function() { |
|
104 | 104 | return new ExpectationAutoStorage(); |
105 | 105 | }); |
106 | 106 | |
107 | -$di->register('expectationBackup', function () { |
|
107 | +$di->register('expectationBackup', function() { |
|
108 | 108 | return new ExpectationAutoStorage(); |
109 | 109 | }); |
110 | 110 | |
111 | -$di->register('requestStorage', function () { |
|
111 | +$di->register('requestStorage', function() { |
|
112 | 112 | return new RequestAutoStorage(); |
113 | 113 | }); |
114 | 114 | |
115 | -$di->register('scenarioStorage', function () { |
|
115 | +$di->register('scenarioStorage', function() { |
|
116 | 116 | return new ScenarioAutoStorage(); |
117 | 117 | }); |
118 | 118 | |
119 | -$di->register('requestExpectationComparator', function () use ($di) { |
|
119 | +$di->register('requestExpectationComparator', function() use ($di) { |
|
120 | 120 | return new RequestExpectationComparator( |
121 | 121 | $di->get('matcherFactory'), |
122 | 122 | $di->get('inputSourceFactory'), |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | ); |
126 | 126 | }); |
127 | 127 | |
128 | -$di->register('requestBuilder', function () { |
|
128 | +$di->register('requestBuilder', function() { |
|
129 | 129 | return RequestBuilderFactory::createRequestBuilder(); |
130 | 130 | }); |
131 | 131 | |
132 | -$di->register('fileExpectationsLoader', function () use ($di) { |
|
132 | +$di->register('fileExpectationsLoader', function() use ($di) { |
|
133 | 133 | return new FileExpectationsLoader( |
134 | 134 | $di->get('requestBuilder'), |
135 | 135 | $di->get('expectationStorage'), |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | ); |
139 | 139 | }); |
140 | 140 | |
141 | -$di->register('conditionsMatcherFactory', function () use ($di) { |
|
141 | +$di->register('conditionsMatcherFactory', function() use ($di) { |
|
142 | 142 | return new ConditionsMatcherFactory( |
143 | 143 | $di->get('inputSourceFactory'), |
144 | 144 | $di->get('matcherFactory') |
145 | 145 | ); |
146 | 146 | }); |
147 | 147 | |
148 | -$di->register('inputSourceFactory', function () { |
|
148 | +$di->register('inputSourceFactory', function() { |
|
149 | 149 | return new InputSourceFactory([ |
150 | 150 | 'method' => new SingletonLazyCreator(Method::class), |
151 | 151 | 'url' => new SingletonLazyCreator(UrlFromPath::class), |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ]); |
155 | 155 | }); |
156 | 156 | |
157 | -$di->register('router', function () use ($di) { |
|
157 | +$di->register('router', function() use ($di) { |
|
158 | 158 | return new PowerRoute( |
159 | 159 | $di->get('config'), |
160 | 160 | $di->get('actionFactory'), |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ); |
163 | 163 | }); |
164 | 164 | |
165 | -$di->register('matcherFactory', function () use ($di) { |
|
165 | +$di->register('matcherFactory', function() use ($di) { |
|
166 | 166 | return new MatcherFactory([ |
167 | 167 | Matchers::EQUAL_TO => new SingletonLazyCreator(Equals::class), |
168 | 168 | Matchers::MATCHES => new SingletonLazyCreator(RegExpMatcher::class), |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ]); |
173 | 173 | }); |
174 | 174 | |
175 | -$di->register('actionFactory', function () use ($di) { |
|
175 | +$di->register('actionFactory', function() use ($di) { |
|
176 | 176 | return new ActionFactory([ |
177 | 177 | 'addExpectation' => new SingletonLazyCreator( |
178 | 178 | AddExpectationAction::class, |