@@ -206,7 +206,7 @@ |
||
206 | 206 | |
207 | 207 | if ($this->writer->getDebug()) { |
208 | 208 | $text .= '# Cache is '.($this->cache ? 'enabled with key "'.$this->cacheKey.'"' : 'disabled').'.'.PHP_EOL. |
209 | - '#'.PHP_EOL; |
|
209 | + '#'.PHP_EOL; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | if ($this->cache) { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.4.0 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Security\Txt; |
11 | 11 | |
@@ -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 | |
@@ -118,28 +118,28 @@ discard block |
||
118 | 118 | |
119 | 119 | foreach ($keys as $key => $mapping) { |
120 | 120 | if (is_null(config($key, null))) { |
121 | - $this->addLogEntry('"'.__CLASS__.'" cannot process null value for key "'.$key.'".', 'debug'); |
|
121 | + $this->addLogEntry('"' . __CLASS__ . '" cannot process null value for key "' . $key . '".', 'debug'); |
|
122 | 122 | continue; |
123 | - } else if (! function_exists($mapping['validator'])) { |
|
124 | - $this->addLogEntry('"'.__CLASS__.'" cannot find "validator" function named "'.$mapping['validator'].'".', 'warning'); |
|
123 | + } else if (!function_exists($mapping[ 'validator' ])) { |
|
124 | + $this->addLogEntry('"' . __CLASS__ . '" cannot find "validator" function named "' . $mapping[ 'validator' ] . '".', 'warning'); |
|
125 | 125 | continue; |
126 | - } else if (! $mapping['validator'](config($key))) { |
|
127 | - $this->addLogEntry('"'.__CLASS__.'" failed the "validator" function named "'.$mapping['validator'].'".', 'warning'); |
|
126 | + } else if (!$mapping[ 'validator' ](config($key))) { |
|
127 | + $this->addLogEntry('"' . __CLASS__ . '" failed the "validator" function named "' . $mapping[ 'validator' ] . '".', 'warning'); |
|
128 | 128 | continue; |
129 | - } else if (array_key_exists('self', $mapping) && is_bool($mapping['self']) && $mapping['self'] === true) { |
|
130 | - if (! method_exists($this, $mapping['setter'])) { |
|
131 | - $this->addLogEntry('"'.__CLASS__.'" cannot find mapping "setter" method on object "'.get_class($this).'" named "'.$mapping['setter'].'".', 'error'); |
|
129 | + } else if (array_key_exists('self', $mapping) && is_bool($mapping[ 'self' ]) && $mapping[ 'self' ] === true) { |
|
130 | + if (!method_exists($this, $mapping[ 'setter' ])) { |
|
131 | + $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this) . '" named "' . $mapping[ 'setter' ] . '".', 'error'); |
|
132 | 132 | continue; |
133 | 133 | } |
134 | 134 | |
135 | - $this->{$mapping['setter']}(config($key)); |
|
135 | + $this->{$mapping[ 'setter' ]}(config($key)); |
|
136 | 136 | } else { |
137 | - if (! method_exists($this->writer, $mapping['setter'])) { |
|
138 | - $this->addLogEntry('"'.__CLASS__.'" cannot find mapping "setter" method on object "'.get_class($this->writer).'" named "'.$mapping['setter'].'".', 'error'); |
|
137 | + if (!method_exists($this->writer, $mapping[ 'setter' ])) { |
|
138 | + $this->addLogEntry('"' . __CLASS__ . '" cannot find mapping "setter" method on object "' . get_class($this->writer) . '" named "' . $mapping[ 'setter' ] . '".', 'error'); |
|
139 | 139 | continue; |
140 | 140 | } |
141 | 141 | |
142 | - $this->writer->{$mapping['setter']}(config($key)); |
|
142 | + $this->writer->{$mapping[ 'setter' ]}(config($key)); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | Log::$level($text); |
160 | 160 | |
161 | - $this->logEntries[] = ['text' => $text, 'level' => $level]; |
|
161 | + $this->logEntries[ ] = [ 'text' => $text, 'level' => $level ]; |
|
162 | 162 | |
163 | 163 | return $this; |
164 | 164 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function clearLogEntries(): self |
182 | 182 | { |
183 | - $this->logEntries = []; |
|
183 | + $this->logEntries = [ ]; |
|
184 | 184 | |
185 | 185 | return $this; |
186 | 186 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if ($this->cache) { |
196 | 196 | $text = cache($this->cacheKey, null); |
197 | 197 | |
198 | - if (! is_null($text)) { |
|
198 | + if (!is_null($text)) { |
|
199 | 199 | return $text; |
200 | 200 | } |
201 | 201 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | ->getText(); |
206 | 206 | |
207 | 207 | if ($this->writer->getDebug()) { |
208 | - $text .= '# Cache is '.($this->cache ? 'enabled with key "'.$this->cacheKey.'"' : 'disabled').'.'.PHP_EOL. |
|
209 | - '#'.PHP_EOL; |
|
208 | + $text .= '# Cache is ' . ($this->cache ? 'enabled with key "' . $this->cacheKey . '"' : 'disabled') . '.' . PHP_EOL . |
|
209 | + '#' . PHP_EOL; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | if ($this->cache) { |
213 | - cache([$this->cacheKey => $text], now()->addMinutes($this->cacheTime)); |
|
213 | + cache([ $this->cacheKey => $text ], now()->addMinutes($this->cacheTime)); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | return empty($text) ? '' : $text; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function hasWriter(): bool |
373 | 373 | { |
374 | - return ! is_null($this->writer); |
|
374 | + return !is_null($this->writer); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public function getWriter(): Writer |
383 | 383 | { |
384 | - if (! $this->hasWriter()) { |
|
384 | + if (!$this->hasWriter()) { |
|
385 | 385 | throw new Exception('Writer not set.'); |
386 | 386 | } |
387 | 387 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @version v0.4.0 |
7 | 7 | */ |
8 | 8 | Route::get('/.well-known/security.txt', '\AustinHeap\Security\Txt\SecurityTxtController@show') |
9 | - ->name('security.txt'); |
|
9 | + ->name('security.txt'); |
|
10 | 10 | |
11 | 11 | Route::get('/security.txt', '\AustinHeap\Security\Txt\SecurityTxtController@redirect') |
12 | - ->name('security.txt-redirect'); |
|
12 | + ->name('security.txt-redirect'); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.4.0 |
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,9 +5,9 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.4.0 |
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 | */ |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.4.0 |
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.4.0 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Security\Txt; |
11 | 11 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $instance = static::getFacadeRoot(); |
45 | 45 | |
46 | - if (! $instance) { |
|
46 | + if (!$instance) { |
|
47 | 47 | throw new RuntimeException('A facade root has not been set.'); |
48 | 48 | } |
49 | 49 |