| Conditions | 3 | 
| Paths | 4 | 
| Total Lines | 11 | 
| Code Lines | 8 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 30 | public function cleanRelatedTopic(User $user): void | ||
| 31 |     { | ||
| 32 | /** @var Topic[] $topics */ | ||
| 33 |         app('log')->info("user {$user->id} deleted, remove related topics"); | ||
| 34 |         $topics = $this->topicRepository->findAllBy('user_id', $user->id); | ||
| 35 |         foreach ($topics as $topic) { | ||
| 36 |             try { | ||
| 37 | $topic->replies()->delete(); | ||
| 38 | $topic->delete(); | ||
| 39 |             } catch (\Exception $e) { | ||
| 40 |                 app('log')->error("remove topic failed! {$e->getMessage()}"); | ||
| 41 | } | ||
| 45 |