Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
37 | public function prune(Auditable $model): bool |
||
38 | { |
||
39 | if (($threshold = $model->getAuditThreshold()) > 0) { |
||
40 | $forRemoval = $model->audits() |
||
41 | ->latest() |
||
42 | ->get() |
||
43 | ->slice($threshold) |
||
44 | ->pluck('id'); |
||
45 | |||
46 | if (!$forRemoval->isEmpty()) { |
||
47 | return $model->audits() |
||
48 | ->whereIn('id', $forRemoval) |
||
49 | ->delete() > 0; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | return false; |
||
54 | } |
||
56 |