| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 6.7968 |
| Changes | 5 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 25 | 6 | public function prune(Auditable $model): bool |
|
| 26 | { |
||
| 27 | 6 | if (($threshold = $model->getAuditThreshold()) > 0) { |
|
| 28 | $forRemoval = $model->audits() |
||
| 29 | ->latest() |
||
| 30 | ->get() |
||
| 31 | ->slice($threshold) |
||
| 32 | ->pluck('id'); |
||
| 33 | |||
| 34 | if (!$forRemoval->isEmpty()) { |
||
| 35 | return $model->audits() |
||
| 36 | ->whereIn('id', $forRemoval) |
||
| 37 | ->delete() > 0; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | 6 | return false; |
|
| 42 | } |
||
| 44 |