@@ -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 | |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function show() |
29 | 29 | { |
30 | - if (! config('security-txt.enabled', false)) { |
|
30 | + if (!config('security-txt.enabled', false)) { |
|
31 | 31 | abort(404); |
32 | 32 | } |
33 | 33 | |
34 | 34 | return Response::make( |
35 | 35 | app('SecurityTxt')->fetch(), |
36 | 36 | 200, |
37 | - ['Content-Type' => 'text/plain'] |
|
37 | + [ 'Content-Type' => 'text/plain' ] |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function redirect() |
47 | 47 | { |
48 | - if (! config('security-txt.enabled', false)) { |
|
48 | + if (!config('security-txt.enabled', false)) { |
|
49 | 49 | abort(404); |
50 | 50 | } |
51 | 51 |
@@ -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 | |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | __DIR__ . '/config/security-txt.php' => config_path('security-txt.php'), |
37 | 37 | ]); |
38 | 38 | |
39 | - if (! $this->app->routesAreCached()) { |
|
39 | + if (!$this->app->routesAreCached()) { |
|
40 | 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,9 +5,9 @@ |
||
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 | -if (! function_exists('securitytxt')) { |
|
10 | +if (!function_exists('securitytxt')) { |
|
11 | 11 | /** |
12 | 12 | * @return \AustinHeap\Security\Txt\SecurityTxtHelper |
13 | 13 | */ |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | |
125 | 125 | if (!function_exists($mapping['validator'])) { |
126 | 126 | $this->addLogEntry('"' . __CLASS__ . '" cannot find "validator" function named "' . $mapping['validator'] . '".', |
127 | - 'warning'); |
|
127 | + 'warning'); |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
131 | 131 | if (!$mapping['validator'](config($key))) { |
132 | 132 | $this->addLogEntry('"' . __CLASS__ . '" failed the "validator" function named "' . $mapping['validator'] . '".', |
133 | - 'warning'); |
|
133 | + 'warning'); |
|
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $mapping['self'] === true) { |
140 | 140 | if (!method_exists($this, $mapping['setter'])) { |
141 | 141 | $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this) . '" named "' . $mapping['setter'] . '".', |
142 | - 'error'); |
|
142 | + 'error'); |
|
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } else { |
148 | 148 | if (!method_exists($this->writer, $mapping['setter'])) { |
149 | 149 | $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this->writer) . '" named "' . $mapping['setter'] . '".', |
150 | - 'error'); |
|
150 | + 'error'); |
|
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | if ($this->writer->getDebug()) { |
220 | 220 | $text .= '# Cache is ' . ($this->cache ? 'enabled with key "' . $this->cacheKey . '"' : 'disabled') . '.' . PHP_EOL . |
221 | - '#' . PHP_EOL; |
|
221 | + '#' . PHP_EOL; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | if ($this->cache) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $logEntries = []; |
|
50 | + protected $logEntries = [ ]; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Enable built-in cache. |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | public static function buildWriterDefaultKeys() |
91 | 91 | { |
92 | 92 | return [ |
93 | - 'security-txt.enabled' => ['validator' => 'is_bool', 'setter' => 'setEnabled', 'self' => true], |
|
94 | - 'security-txt.debug' => ['validator' => 'is_bool', 'setter' => 'setDebug'], |
|
95 | - 'security-txt.cache' => ['validator' => 'is_bool', 'setter' => 'setCache', 'self' => true], |
|
96 | - 'security-txt.cache-time' => ['validator' => 'is_numeric', 'setter' => 'setCacheTime', 'self' => true], |
|
97 | - 'security-txt.cache-key' => ['validator' => 'is_string', 'setter' => 'setCacheKey', 'self' => true], |
|
98 | - 'security-txt.comments' => ['validator' => 'is_bool', 'setter' => 'setComments'], |
|
99 | - 'security-txt.contacts' => ['validator' => 'is_array', 'setter' => 'addContacts'], |
|
100 | - 'security-txt.encryption' => ['validator' => 'is_string', 'setter' => 'setEncryption'], |
|
101 | - 'security-txt.disclosure' => ['validator' => 'is_string', 'setter' => 'setDisclosure'], |
|
102 | - 'security-txt.acknowledgement' => ['validator' => 'is_string', 'setter' => 'setAcknowledgement'], |
|
93 | + 'security-txt.enabled' => [ 'validator' => 'is_bool', 'setter' => 'setEnabled', 'self' => true ], |
|
94 | + 'security-txt.debug' => [ 'validator' => 'is_bool', 'setter' => 'setDebug' ], |
|
95 | + 'security-txt.cache' => [ 'validator' => 'is_bool', 'setter' => 'setCache', 'self' => true ], |
|
96 | + 'security-txt.cache-time' => [ 'validator' => 'is_numeric', 'setter' => 'setCacheTime', 'self' => true ], |
|
97 | + 'security-txt.cache-key' => [ 'validator' => 'is_string', 'setter' => 'setCacheKey', 'self' => true ], |
|
98 | + 'security-txt.comments' => [ 'validator' => 'is_bool', 'setter' => 'setComments' ], |
|
99 | + 'security-txt.contacts' => [ 'validator' => 'is_array', 'setter' => 'addContacts' ], |
|
100 | + 'security-txt.encryption' => [ 'validator' => 'is_string', 'setter' => 'setEncryption' ], |
|
101 | + 'security-txt.disclosure' => [ 'validator' => 'is_string', 'setter' => 'setDisclosure' ], |
|
102 | + 'security-txt.acknowledgement' => [ 'validator' => 'is_string', 'setter' => 'setAcknowledgement' ], |
|
103 | 103 | ]; |
104 | 104 | } |
105 | 105 | |
@@ -122,36 +122,36 @@ discard block |
||
122 | 122 | continue; |
123 | 123 | } |
124 | 124 | |
125 | - if (!function_exists($mapping['validator'])) { |
|
126 | - $this->addLogEntry('"' . __CLASS__ . '" cannot find "validator" function named "' . $mapping['validator'] . '".', |
|
125 | + if (!function_exists($mapping[ 'validator' ])) { |
|
126 | + $this->addLogEntry('"' . __CLASS__ . '" cannot find "validator" function named "' . $mapping[ 'validator' ] . '".', |
|
127 | 127 | 'warning'); |
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
131 | - if (!$mapping['validator'](config($key))) { |
|
132 | - $this->addLogEntry('"' . __CLASS__ . '" failed the "validator" function named "' . $mapping['validator'] . '".', |
|
131 | + if (!$mapping[ 'validator' ](config($key))) { |
|
132 | + $this->addLogEntry('"' . __CLASS__ . '" failed the "validator" function named "' . $mapping[ 'validator' ] . '".', |
|
133 | 133 | 'warning'); |
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | 137 | if (array_key_exists('self', $mapping) && |
138 | - is_bool($mapping['self']) && |
|
139 | - $mapping['self'] === true) { |
|
140 | - if (!method_exists($this, $mapping['setter'])) { |
|
141 | - $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this) . '" named "' . $mapping['setter'] . '".', |
|
138 | + is_bool($mapping[ 'self' ]) && |
|
139 | + $mapping[ 'self' ] === true) { |
|
140 | + if (!method_exists($this, $mapping[ 'setter' ])) { |
|
141 | + $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this) . '" named "' . $mapping[ 'setter' ] . '".', |
|
142 | 142 | 'error'); |
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | |
146 | - $this->{$mapping['setter']}(config($key)); |
|
146 | + $this->{$mapping[ 'setter' ]}(config($key)); |
|
147 | 147 | } else { |
148 | - if (!method_exists($this->writer, $mapping['setter'])) { |
|
149 | - $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this->writer) . '" named "' . $mapping['setter'] . '".', |
|
148 | + if (!method_exists($this->writer, $mapping[ 'setter' ])) { |
|
149 | + $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this->writer) . '" named "' . $mapping[ 'setter' ] . '".', |
|
150 | 150 | 'error'); |
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | |
154 | - $this->writer->{$mapping['setter']}(config($key)); |
|
154 | + $this->writer->{$mapping[ 'setter' ]}(config($key)); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | Log::$level($text); |
172 | 172 | |
173 | - $this->logEntries[] = ['text' => $text, 'level' => $level]; |
|
173 | + $this->logEntries[ ] = [ 'text' => $text, 'level' => $level ]; |
|
174 | 174 | |
175 | 175 | return $this; |
176 | 176 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function clearLogEntries(): self |
194 | 194 | { |
195 | - $this->logEntries = []; |
|
195 | + $this->logEntries = [ ]; |
|
196 | 196 | |
197 | 197 | return $this; |
198 | 198 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | if ($this->cache) { |
225 | - cache([$this->cacheKey => $text], now()->addMinutes($this->cacheTime)); |
|
225 | + cache([ $this->cacheKey => $text ], now()->addMinutes($this->cacheTime)); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | return empty($text) ? '' : $text; |
@@ -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', '\AustinHeap\Security\Txt\SecurityTxtController@redirect') |
14 | - ->name('security.txt-redirect'); |
|
14 | + ->name('security.txt-redirect'); |