Skip to content

Commit

Permalink
Some fixes in code style
Browse files Browse the repository at this point in the history
  • Loading branch information
mcustiel committed Mar 3, 2016
1 parent 1909960 commit b9d54f0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/Server/Actions/AddExpectationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ private function validateExpectation(Expectation $expectation)

private function validateScenarioConfig(Expectation $expectation)
{
if (
!$expectation->getScenarioName()
if (!$expectation->getScenarioName()
&& ($expectation->getScenarioStateIs() || $expectation->getNewScenarioState())
) {
$this->logger->error('Scenario name related misconfiguration');
Expand Down
9 changes: 7 additions & 2 deletions src/Server/Actions/VerifyRequestFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ private function processScenario($foundExpectation)
{
if ($foundExpectation->getNewScenarioState()) {
if (! $foundExpectation->getScenarioName()) {
throw new \RuntimeException('Expecting scenario state without specifying scenario name');
throw new \RuntimeException(
'Expecting scenario state without specifying scenario name'
);
}
$this->scenarioStorage->setScenarioState($foundExpectation->getScenarioName(), $foundExpectation->getNewScenarioState());
$this->scenarioStorage->setScenarioState(
$foundExpectation->getScenarioName(),
$foundExpectation->getNewScenarioState()
);
}
}
}
4 changes: 2 additions & 2 deletions src/Server/Config/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
'listExpectations' => new SingletonLazyCreator(
ListExpectationsAction::class,
[$di->get('expectationStorage')]
),
),
'clearExpectations' => new SingletonLazyCreator(
ClearExpectationsAction::class,
[$di->get('expectationStorage')]
Expand Down Expand Up @@ -164,7 +164,7 @@
'storeRequest' => new SingletonLazyCreator(
StoreRequestAction::class,
[$di->get('requestStorage')]
),
),
]);
});

Expand Down
6 changes: 4 additions & 2 deletions src/Server/Http/Implementation/ReactPhpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ public function setRequestHandler(RequestHandlerInterface $handler)
*/
public function listen($port, $host)
{
$this->http->on('request',
$this->http->on(
'request',
function (ReactRequest $request, ReactResponse $response) {
return $this->onRequest($request, $response);
});
}
);
$this->logger->info("Phiremock http server listening on $host:$port");

$this->socket->listen($port, $host);
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Http/RequestFilters/HeadersConditionsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private function checkValueIsArrayOrThrowException($value)
if (!is_array($value)) {
throw new FilterErrorException(
'Error trying to parse headers condition. It should be a collection.'
);
);
}
}
}

0 comments on commit b9d54f0

Please sign in to comment.