| Conditions | 5 |
| Paths | 9 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function record($resourceReports) |
||
| 15 | { |
||
| 16 | $file = config('stethoscope.log_file_storage.path') . now()->format('Y-m-d'); |
||
| 17 | |||
| 18 | $this->storage = Storage::disk(config('stethoscope.log_file_storage.driver')); |
||
|
|
|||
| 19 | |||
| 20 | $log = ''; |
||
| 21 | |||
| 22 | foreach ($resourceReports as $resource => $resourceReport) { |
||
| 23 | $method = $resource . 'Message'; |
||
| 24 | |||
| 25 | if (method_exists($this, $method)) { |
||
| 26 | $log .= $this->$method($resourceReport) . "\n"; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($log != '') { |
||
| 31 | $log = $this->timeMessage() . "\n" . $log; |
||
| 32 | |||
| 33 | if ($this->storage->exists($file)) |
||
| 34 | $log = $this->storage->get($file) . "\n \n" . $log; |
||
| 35 | |||
| 36 | $this->storage->put($file, $log); |
||
| 37 | } |
||
| 40 |