Completed
Push — master ( 1e0cee...ddd808 )
by Austin
04:41 queued 02:35
created

src/SecurityTxtController.php (1 issue)

1
<?php
2
/**
3
 * src/SecurityTxtController.php.
4
 *
5
 * @author      Austin Heap <[email protected]>
6
 * @version     v0.3.2
7
 */
8
declare(strict_types=1);
9
10
namespace AustinHeap\Security\Txt;
11
12
use Response;
13
14
/**
15
 * SecurityTxtController.
16
 *
17
 * @link        https://github.com/austinheap/laravel-security-txt
18
 * @link        https://packagist.org/packages/austinheap/laravel-security-txt
19
 * @link        https://austinheap.github.io/laravel-security-txt/classes/AustinHeap.Security.Txt.SecurityTxtController.html
20
 */
21
class SecurityTxtController extends \Illuminate\Routing\Controller
22
{
23
    /**
24
     * Show the security.txt file.
25
     *
26
     * @return Response
27
     */
28
    public function show()
29
    {
30
        if (! config('security-txt.enabled', false)) {
31
            abort(404);
32
        }
33
34
        return Response::make(
35
            app('SecurityTxt')->fetch(),
36
            200,
37
            ['Content-Type' => 'text/plain']
38
        );
39
    }
40
41
    /**
42
     * Redirect to the proper location of the security.txt file.
43
     *
44
     * @return Response
45
     */
46
    public function redirect()
47
    {
48
        if (! config('security-txt.enabled', false)) {
49
            abort(404);
50
        }
51
52
        return redirect()->route('security.txt');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect()->route('security.txt') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Response.
Loading history...
53
    }
54
}
55