ShortUrlController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 4
c 3
b 0
f 0
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A go() 0 7 1
1
<?php
2
3
namespace Helldar\ShortUrl\Http\Controllers;
4
5
use Helldar\ShortUrl\Facades\ShortUrl;
6
use Illuminate\Http\RedirectResponse;
7
use Illuminate\Routing\Controller as BaseController;
8
9
class ShortUrlController extends BaseController
10
{
11
    /**
12
     * @param  string  $key
13
     *
14
     * @return \Illuminate\Http\RedirectResponse
15
     */
16 1
    public function go(string $key): RedirectResponse
17
    {
18 1
        $item = ShortUrl::search($key);
19
20 1
        $code = config('short_url.redirect_code');
21
22 1
        return redirect()->away($item->url, $code);
23
    }
24
}
25