Skip to content

Commit b61b332

Browse files
Reduce common control flows
1 parent 8137d56 commit b61b332

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Middleware/RouterContextMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ public function __construct(
3030

3131
public function handle(Envelope $envelope, StackInterface $stack): Envelope
3232
{
33+
$context = $this->router->getContext();
34+
3335
if (!$envelope->last(ConsumedByWorkerStamp::class) || !$contextStamp = $envelope->last(RouterContextStamp::class)) {
34-
$context = $this->router->getContext();
3536
$envelope = $envelope->with(new RouterContextStamp(
3637
$context->getBaseUrl(),
3738
$context->getMethod(),
@@ -46,7 +47,6 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
4647
return $stack->next()->handle($envelope, $stack);
4748
}
4849

49-
$context = $this->router->getContext();
5050
$currentBaseUrl = $context->getBaseUrl();
5151
$currentMethod = $context->getMethod();
5252
$currentHost = $context->getHost();

0 commit comments

Comments
 (0)