Total Complexity | 4 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class ResultErrorLogger implements Log\LoggerAwareInterface |
||
12 | { |
||
13 | use Traits\Logger; |
||
14 | |||
15 | public function __invoke(object $query, callable $next): Interfaces\Result |
||
16 | { |
||
17 | /** @var \RemotelyLiving\PHPQueryBus\Interfaces\Result $result */ |
||
18 | $result = $next($query); |
||
19 | |||
20 | if ($result->hasErrors()) { |
||
21 | $this->getLogger()->error('Query bus result fetched with errors', $this->formatErrorContext($result)); |
||
22 | } |
||
23 | |||
24 | return $result; |
||
25 | } |
||
26 | |||
27 | private function formatErrorContext(Interfaces\Result $result): array |
||
41 | } |
||
42 | } |
||
43 |