private function searchForMatchingExpectation(ServerRequestInterface $request) { $lastFound = null; foreach ($this->storage->listExpectations() as $expectation) { $lastFound = $this->getNextMatchingExpectation($lastFound, $request, $expectation); } return $lastFound; }
/** * * {@inheritDoc} * * @see \Mcustiel\PowerRoute\Actions\ActionInterface::execute() */ public function execute(TransactionData $transactionData, $argument = null) { $list = json_encode($this->storage->listExpectations()); $transactionData->setResponse($transactionData->getResponse()->withBody(new StringStream($list))->withHeader('Content-type', 'application/json')); }