Passed
Pull Request — master (#42)
by Raed
10:11
created

Callbacks::unauthorized()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace LaraCrafts\GeoRoutes;
4
5
use Symfony\Component\HttpKernel\Exception\HttpException;
6
7
class Callbacks
8
{
9
    /**
10
     * Return a HTTP 401 Unauthorized response.
11
     *
12
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
13
     */
14 64
    public static function unauthorized()
15
    {
16 64
        throw new HttpException(401);
17
    }
18
    
19
    /**
20
     * Return a HTTP 404 Not Found response.
21
     *
22
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
23
     */
24 32
    public static function notFound()
25
    {
26 32
        throw new HttpException(404);
27
    }
28
29
    /**
30
     * Redirect to given route.
31
     *
32
     * @param string $route
33
     * @return \Illuminate\Http\RedirectResponse
34
     */
35 32
    public static function redirectTo(string $route)
36
    {
37 32
        return redirect()->route($route);
38
    }
39
}
40