From be8fb0927db6685933aa8cfd06d2b07a7d30edef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=C3=B6sel?= Date: Tue, 28 Mar 2023 21:16:31 +0200 Subject: [PATCH] improve search performance (#12) --- src/Actions/SearchRequestAction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Actions/SearchRequestAction.php b/src/Actions/SearchRequestAction.php index b021b70..7db7dc7 100644 --- a/src/Actions/SearchRequestAction.php +++ b/src/Actions/SearchRequestAction.php @@ -82,8 +82,8 @@ private function searchForMatchingExpectation(ServerRequestInterface $request): private function getNextMatchingExpectation(?Expectation $lastFound, ServerRequestInterface $request, Expectation $expectation): ?Expectation { - if ($this->comparator->equals($request, $expectation)) { - if (null === $lastFound || $expectation->getPriority() > $lastFound->getPriority()) { + if (null === $lastFound || $expectation->getPriority() > $lastFound->getPriority()) { + if ($this->comparator->equals($request, $expectation)) { $lastFound = $expectation; } }