| @@ -22,7 +22,7 @@ | ||
| 22 | 22 |      'comments'          => env('SECURITY_TXT_COMMENTS', true), | 
| 23 | 23 | |
| 24 | 24 |      'contacts'          => env('SECURITY_TXT_CONTACT', false) !== false ? | 
| 25 | -                           [env('SECURITY_TXT_CONTACT')] : null, | |
| 25 | +                           [ env('SECURITY_TXT_CONTACT') ] : null, | |
| 26 | 26 | |
| 27 | 27 |      'encryption'        => env('SECURITY_TXT_ENCRYPTION', null), | 
| 28 | 28 | |
| @@ -8,7 +8,7 @@ | ||
| 8 | 8 | */ | 
| 9 | 9 | |
| 10 | 10 |  Route::get('/.well-known/security.txt', '\AustinHeap\Security\Txt\SecurityTxtController@show') | 
| 11 | -     ->name('security.txt'); | |
| 11 | +        ->name('security.txt'); | |
| 12 | 12 | |
| 13 | 13 |  Route::get('/security.txt', function () { | 
| 14 | 14 |      return redirect()->route('security.txt'); | 
| @@ -10,6 +10,6 @@ | ||
| 10 | 10 |  Route::get('/.well-known/security.txt', '\AustinHeap\Security\Txt\SecurityTxtController@show') | 
| 11 | 11 |       ->name('security.txt'); | 
| 12 | 12 | |
| 13 | -Route::get('/security.txt', function () { | |
| 13 | +Route::get('/security.txt', function() { | |
| 14 | 14 |      return redirect()->route('security.txt'); | 
| 15 | 15 | }); | 
| @@ -149,12 +149,12 @@ | ||
| 149 | 149 | } | 
| 150 | 150 | |
| 151 | 151 | $text = $this->writer | 
| 152 | - ->generate() | |
| 153 | - ->getText(); | |
| 152 | + ->generate() | |
| 153 | + ->getText(); | |
| 154 | 154 | |
| 155 | 155 |          if ($this->writer->getComments()) { | 
| 156 | 156 | $text .= '# Cache is '.($this->cache ? 'enabled with key "'.$this->cacheKey.'"' : 'disabled').'.'.PHP_EOL. | 
| 157 | - '#'.PHP_EOL; | |
| 157 | + '#'.PHP_EOL; | |
| 158 | 158 | } | 
| 159 | 159 | |
| 160 | 160 |          if ($this->cache) { | 
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | * @author Austin Heap <[email protected]> | 
| 6 | 6 | * @version v0.3.2 | 
| 7 | 7 | */ | 
| 8 | -declare(strict_types=1); | |
| 8 | +declare(strict_types = 1); | |
| 9 | 9 | |
| 10 | 10 | namespace AustinHeap\Security\Txt; | 
| 11 | 11 | |
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | * | 
| 38 | 38 | * @var array | 
| 39 | 39 | */ | 
| 40 | - protected $logEntries = []; | |
| 40 | + protected $logEntries = [ ]; | |
| 41 | 41 | |
| 42 | 42 | /** | 
| 43 | 43 | * Enable built-in cache. | 
| @@ -70,45 +70,45 @@ discard block | ||
| 70 | 70 | $this->writer = new Writer(); | 
| 71 | 71 | |
| 72 | 72 | $keys = [ | 
| 73 | - 'security-txt.enabled' => ['validator' => 'is_bool', 'setter' => 'setEnabled', 'self' => true], | |
| 74 | - 'security-txt.debug' => ['validator' => 'is_bool', 'setter' => 'setDebug'], | |
| 75 | - 'security-txt.cache' => ['validator' => 'is_bool', 'setter' => 'setCache', 'self' => true], | |
| 76 | - 'security-txt.cache-time' => ['validator' => 'is_numeric', 'setter' => 'setCacheTime', 'self' => true], | |
| 77 | - 'security-txt.cache-key' => ['validator' => 'is_string', 'setter' => 'setCacheKey', 'self' => true], | |
| 78 | - 'security-txt.comments' => ['validator' => 'is_bool', 'setter' => 'setComments'], | |
| 79 | - 'security-txt.contacts' => ['validator' => 'is_array', 'setter' => 'setContacts'], | |
| 80 | - 'security-txt.encryption' => ['validator' => 'is_string', 'setter' => 'setEncryption'], | |
| 81 | - 'security-txt.disclosure' => ['validator' => 'is_string', 'setter' => 'setDisclosure'], | |
| 82 | - 'security-txt.acknowledgement' => ['validator' => 'is_string', 'setter' => 'setAcknowledgement'], | |
| 73 | + 'security-txt.enabled' => [ 'validator' => 'is_bool', 'setter' => 'setEnabled', 'self' => true ], | |
| 74 | + 'security-txt.debug' => [ 'validator' => 'is_bool', 'setter' => 'setDebug' ], | |
| 75 | + 'security-txt.cache' => [ 'validator' => 'is_bool', 'setter' => 'setCache', 'self' => true ], | |
| 76 | + 'security-txt.cache-time' => [ 'validator' => 'is_numeric', 'setter' => 'setCacheTime', 'self' => true ], | |
| 77 | + 'security-txt.cache-key' => [ 'validator' => 'is_string', 'setter' => 'setCacheKey', 'self' => true ], | |
| 78 | + 'security-txt.comments' => [ 'validator' => 'is_bool', 'setter' => 'setComments' ], | |
| 79 | + 'security-txt.contacts' => [ 'validator' => 'is_array', 'setter' => 'setContacts' ], | |
| 80 | + 'security-txt.encryption' => [ 'validator' => 'is_string', 'setter' => 'setEncryption' ], | |
| 81 | + 'security-txt.disclosure' => [ 'validator' => 'is_string', 'setter' => 'setDisclosure' ], | |
| 82 | + 'security-txt.acknowledgement' => [ 'validator' => 'is_string', 'setter' => 'setAcknowledgement' ], | |
| 83 | 83 | ]; | 
| 84 | 84 | |
| 85 | 85 |          foreach ($keys as $key => $mapping) { | 
| 86 | 86 |              if (empty(config($key, null))) { | 
| 87 | -                $this->addLogEntry('"'.__CLASS__.'" cannot process empty value for key "'.$key.'".', 'notice'); | |
| 87 | +                $this->addLogEntry('"' . __CLASS__ . '" cannot process empty value for key "' . $key . '".', 'notice'); | |
| 88 | 88 | continue; | 
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | -            if (! $mapping['validator'](config($key))) { | |
| 92 | -                $this->addLogEntry('"'.__CLASS__.'" cannot find mapping "validator" method named "'.$mapping['setter'].'".', 'warning'); | |
| 91 | +            if (!$mapping[ 'validator' ](config($key))) { | |
| 92 | +                $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "validator" method named "' . $mapping[ 'setter' ] . '".', 'warning'); | |
| 93 | 93 | continue; | 
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | 96 |              if (array_key_exists('self', $mapping) && | 
| 97 | - is_bool($mapping['self']) && | |
| 98 | -                $mapping['self'] === true) { | |
| 99 | -                if (! method_exists($this, $mapping['setter'])) { | |
| 100 | -                    $this->addLogEntry('"'.__CLASS__.'" cannot find mapping "setter" method on object "'.get_class($this).'" named "'.$mapping['setter'].'".', 'error'); | |
| 97 | + is_bool($mapping[ 'self' ]) && | |
| 98 | +                $mapping[ 'self' ] === true) { | |
| 99 | +                if (!method_exists($this, $mapping[ 'setter' ])) { | |
| 100 | +                    $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this) . '" named "' . $mapping[ 'setter' ] . '".', 'error'); | |
| 101 | 101 | continue; | 
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | -                $this->{$mapping['setter']}(config($key)); | |
| 104 | +                $this->{$mapping[ 'setter' ]}(config($key)); | |
| 105 | 105 |              } else { | 
| 106 | -                if (! method_exists($this->writer, $mapping['setter'])) { | |
| 107 | -                    $this->addLogEntry('"'.__CLASS__.'" cannot find mapping "setter" method on object "'.get_class($this->writer).'" named "'.$mapping['setter'].'".', 'error'); | |
| 106 | +                if (!method_exists($this->writer, $mapping[ 'setter' ])) { | |
| 107 | +                    $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this->writer) . '" named "' . $mapping[ 'setter' ] . '".', 'error'); | |
| 108 | 108 | continue; | 
| 109 | 109 | } | 
| 110 | 110 | |
| 111 | -                $this->writer->{$mapping['setter']}(config($key)); | |
| 111 | +                $this->writer->{$mapping[ 'setter' ]}(config($key)); | |
| 112 | 112 | } | 
| 113 | 113 | } | 
| 114 | 114 | |
| @@ -126,7 +126,7 @@ discard block | ||
| 126 | 126 |      { | 
| 127 | 127 | \Log::$level($text); | 
| 128 | 128 | |
| 129 | - $this->logEntries[] = ['text' => $text, 'level' => $level]; | |
| 129 | + $this->logEntries[ ] = [ 'text' => $text, 'level' => $level ]; | |
| 130 | 130 | |
| 131 | 131 | return $this; | 
| 132 | 132 | } | 
| @@ -141,7 +141,7 @@ discard block | ||
| 141 | 141 |          if ($this->cache) { | 
| 142 | 142 | $text = cache($this->cacheKey, null); | 
| 143 | 143 | |
| 144 | -            if (! is_null($text)) { | |
| 144 | +            if (!is_null($text)) { | |
| 145 | 145 | return $text; | 
| 146 | 146 | } | 
| 147 | 147 | } | 
| @@ -151,12 +151,12 @@ discard block | ||
| 151 | 151 | ->getText(); | 
| 152 | 152 | |
| 153 | 153 |          if ($this->writer->getComments()) { | 
| 154 | - $text .= '# Cache is '.($this->cache ? 'enabled with key "'.$this->cacheKey.'"' : 'disabled').'.'.PHP_EOL. | |
| 155 | - '#'.PHP_EOL; | |
| 154 | + $text .= '# Cache is ' . ($this->cache ? 'enabled with key "' . $this->cacheKey . '"' : 'disabled') . '.' . PHP_EOL . | |
| 155 | + '#' . PHP_EOL; | |
| 156 | 156 | } | 
| 157 | 157 | |
| 158 | 158 |          if ($this->cache) { | 
| 159 | - cache([$this->cacheKey => $text], now()->addMinutes($this->cacheTime)); | |
| 159 | + cache([ $this->cacheKey => $text ], now()->addMinutes($this->cacheTime)); | |
| 160 | 160 | } | 
| 161 | 161 | |
| 162 | 162 | return empty($text) ? '' : $text; | 
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * @author Austin Heap <[email protected]> | 
| 6 | 6 | * @version v0.3.2 | 
| 7 | 7 | */ | 
| 8 | -declare(strict_types=1); | |
| 8 | +declare(strict_types = 1); | |
| 9 | 9 | |
| 10 | 10 | namespace AustinHeap\Security\Txt; | 
| 11 | 11 | |
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | * @author Austin Heap <[email protected]> | 
| 6 | 6 | * @version v0.3.2 | 
| 7 | 7 | */ | 
| 8 | -declare(strict_types=1); | |
| 8 | +declare(strict_types = 1); | |
| 9 | 9 | |
| 10 | 10 | namespace AustinHeap\Security\Txt; | 
| 11 | 11 | |
| @@ -33,14 +33,14 @@ discard block | ||
| 33 | 33 | public function boot() | 
| 34 | 34 |      { | 
| 35 | 35 | $this->publishes([ | 
| 36 | -            __DIR__.'/config/security-txt.php' => config_path('security-txt.php'), | |
| 36 | +            __DIR__ . '/config/security-txt.php' => config_path('security-txt.php'), | |
| 37 | 37 | ]); | 
| 38 | 38 | |
| 39 | -        if (! $this->app->routesAreCached()) { | |
| 40 | - require __DIR__.'/routes/security-txt.php'; | |
| 39 | +        if (!$this->app->routesAreCached()) { | |
| 40 | + require __DIR__ . '/routes/security-txt.php'; | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | -        if (! defined('LARAVEL_SECURITY_TXT_VERSION')) { | |
| 43 | +        if (!defined('LARAVEL_SECURITY_TXT_VERSION')) { | |
| 44 | 44 |              define('LARAVEL_SECURITY_TXT_VERSION', SecurityTxtHelper::VERSION); | 
| 45 | 45 | } | 
| 46 | 46 | } | 
| @@ -53,10 +53,10 @@ discard block | ||
| 53 | 53 | public function register() | 
| 54 | 54 |      { | 
| 55 | 55 | $this->mergeConfigFrom( | 
| 56 | - __DIR__.'/config/security-txt.php', 'security-txt' | |
| 56 | + __DIR__ . '/config/security-txt.php', 'security-txt' | |
| 57 | 57 | ); | 
| 58 | 58 | |
| 59 | -        $this->app->singleton('securitytxt', function () { | |
| 59 | +        $this->app->singleton('securitytxt', function() { | |
| 60 | 60 | return new SecurityTxtHelper; | 
| 61 | 61 | }); | 
| 62 | 62 | } | 
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | * @author Austin Heap <[email protected]> | 
| 6 | 6 | * @version v0.3.2 | 
| 7 | 7 | */ | 
| 8 | -declare(strict_types=1); | |
| 8 | +declare(strict_types = 1); | |
| 9 | 9 | |
| 10 | 10 | namespace AustinHeap\Security\Txt; | 
| 11 | 11 | |
| @@ -25,10 +25,10 @@ discard block | ||
| 25 | 25 | */ | 
| 26 | 26 | public function show() | 
| 27 | 27 |      { | 
| 28 | -        if (! config('security-txt.enabled', false)) { | |
| 28 | +        if (!config('security-txt.enabled', false)) { | |
| 29 | 29 | abort(404); | 
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | - return \Response::make((new SecurityTxtHelper)->fetch(), 200, ['Content-Type' => 'text/plain']); | |
| 32 | + return \Response::make((new SecurityTxtHelper)->fetch(), 200, [ 'Content-Type' => 'text/plain' ]); | |
| 33 | 33 | } | 
| 34 | 34 | } |