Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class Log implements Output |
||
10 | { |
||
11 | public function boot() |
||
13 | // |
||
14 | } |
||
15 | |||
16 | public function output(Collection $detectedQueries, Response $response) |
||
17 | { |
||
18 | $this->log('Detected N+1 Query'); |
||
19 | |||
20 | foreach ($detectedQueries as $detectedQuery) { |
||
21 | $logOutput = 'Model: '.$detectedQuery['model'] . PHP_EOL; |
||
22 | |||
23 | $logOutput .= 'Relation: '.$detectedQuery['relation'] . PHP_EOL; |
||
24 | |||
25 | $logOutput .= 'Num-Called: '.$detectedQuery['count'] . PHP_EOL; |
||
26 | |||
27 | $logOutput .= 'Call-Stack:' . PHP_EOL; |
||
28 | |||
29 | foreach ($detectedQuery['sources'] as $source) { |
||
30 | $logOutput .= '#'.$source->index.' '.$source->name.':'.$source->line . PHP_EOL; |
||
31 | } |
||
32 | |||
33 | $this->log($logOutput); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | private function log(string $message) |
||
40 | } |
||
41 | } |
||
42 |