Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
9 / 9 |
AustinHeap\Security\Txt\SecurityTxtController | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
9 / 9 |
show | |
100.00% |
1 / 1 |
2 | |
100.00% |
6 / 6 |
|||
redirect | |
100.00% |
1 / 1 |
2 | |
100.00% |
3 / 3 |
<?php | |
/** | |
* src/SecurityTxtController.php. | |
* | |
* @author Austin Heap <me@austinheap.com> | |
* @version v0.4.0 | |
*/ | |
declare(strict_types=1); | |
namespace AustinHeap\Security\Txt; | |
use Response; | |
/** | |
* SecurityTxtController. | |
* | |
* @link https://github.com/austinheap/laravel-security-txt | |
* @link https://packagist.org/packages/austinheap/laravel-security-txt | |
* @link https://austinheap.github.io/laravel-security-txt/classes/AustinHeap.Security.Txt.SecurityTxtController.html | |
* @link https://securitytext.org/ | |
*/ | |
class SecurityTxtController extends \Illuminate\Routing\Controller | |
{ | |
/** | |
* Show the security.txt file. | |
* | |
* @return Response | |
*/ | |
public function show() | |
{ | |
if (! config('security-txt.enabled', false)) { | |
abort(404); | |
} | |
return Response::make( | |
app('SecurityTxt')->fetch(), | |
200, | |
['Content-Type' => 'text/plain'] | |
); | |
} | |
/** | |
* Redirect to the proper location of the security.txt file. | |
* | |
* @return Response | |
*/ | |
public function redirect() | |
{ | |
if (! config('security-txt.enabled', false)) { | |
abort(404); | |
} | |
return redirect()->route('security.txt'); | |
} | |
} |