Conditions | 3 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 1 | public function handle(string $locale): void |
|
25 | { |
||
26 | try{ |
||
27 | 1 | $currentUrlRecord = UrlRecord::findByModel($this->model, $locale); |
|
28 | |||
29 | 1 | if($recentRedirect = UrlRecord::findRecentRedirect($this->model, $locale)){ |
|
30 | |||
31 | 1 | $recentRedirectSlug = $recentRedirect->slug; |
|
32 | 1 | $recentRedirect->delete(); |
|
33 | |||
34 | 1 | $currentUrlRecord->replaceAndRedirect(['slug' => $recentRedirectSlug]); |
|
35 | } |
||
36 | } |
||
37 | catch(UrlRecordNotFound $e) |
||
38 | { |
||
39 | // No url present so nothing to do here... |
||
43 |