PreviewController::show()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 4
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Devpri\Tinre\Http\Controllers;
4
5
use Devpri\Tinre\Models\Url;
6
use Illuminate\Http\Request;
7
8
class PreviewController extends Controller
9
{
10 2
    public function show(Request $request, $path)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

10
    public function show(/** @scrutinizer ignore-unused */ Request $request, $path)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
11
    {
12 2
        $url = URL::select(['long_url', 'path', 'created_at'])->where(['path' => $path, 'active' => 1])->first();
13
14 2
        if (! $url) {
15 1
            return redirect('/');
16
        }
17
18 1
        return view('tinre::preview', ['url' => $url]);
19
    }
20
}
21