| Conditions | 3 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.009 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 3 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 25 | { |
||
| 26 | try { |
||
| 27 | 3 | return $handler->handle($request); |
|
| 28 | 2 | } catch (Throwable $e) { |
|
| 29 | // FIXME Mega ugly hack to avoid a closed EntityManager to make shlink fail forever on swoole contexts |
||
| 30 | // Should be fixed with request-shared EntityManagers, which is not supported by the ServiceManager |
||
| 31 | 2 | if (! $this->em->isOpen()) { |
|
| 32 | (function () { |
||
| 33 | 1 | $this->closed = false; |
|
|
|
|||
| 34 | 1 | })->bindTo($this->em, EntityManager::class)(); |
|
| 35 | } |
||
| 36 | |||
| 37 | 2 | throw $e; |
|
| 38 | } finally { |
||
| 39 | 3 | $this->em->getConnection()->close(); |
|
| 40 | 3 | $this->em->clear(); |
|
| 41 | } |
||
| 44 |