Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
13 / 13 |
AustinHeap\Security\Txt\SecurityTxtServiceProvider | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
6 | |
100.00% |
13 / 13 |
boot | |
100.00% |
1 / 1 |
3 | |
100.00% |
7 / 7 |
|||
register | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
anonymousFunction:60#171 | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
getInstance | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
/** | |
* src/SecurityTxtServiceProvider.php. | |
* | |
* @author Austin Heap <me@austinheap.com> | |
* @version v0.4.0 | |
*/ | |
declare(strict_types=1); | |
namespace AustinHeap\Security\Txt; | |
/** | |
* SecurityTxtServiceProvider. | |
* | |
* @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.SecurityTxtServiceProvider.html | |
* @link https://securitytext.org/ | |
*/ | |
class SecurityTxtServiceProvider extends \Illuminate\Support\ServiceProvider | |
{ | |
/** | |
* Indicates if loading of the provider is deferred. | |
* | |
* @var bool | |
*/ | |
protected $defer = false; | |
/** | |
* Perform post-registration booting of services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
$this->publishes([ | |
__DIR__.'/config/security-txt.php' => config_path('security-txt.php'), | |
]); | |
if (! $this->app->routesAreCached()) { | |
require __DIR__.'/routes/security-txt.php'; | |
} | |
if (! defined('LARAVEL_SECURITY_TXT_VERSION')) { | |
define('LARAVEL_SECURITY_TXT_VERSION', SecurityTxtHelper::VERSION); | |
} | |
} | |
/** | |
* Register the service provider. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
$this->mergeConfigFrom( | |
__DIR__.'/config/security-txt.php', 'security-txt' | |
); | |
$this->app->singleton('SecurityTxt', function () { | |
return new SecurityTxtHelper; | |
}); | |
} | |
/** | |
* @return \AustinHeap\Security\Txt\SecurityTxtHelper | |
*/ | |
public static function getInstance() | |
{ | |
return app('SecurityTxt'); | |
} | |
} |