Completed
Push — master ( 1e0cee...ddd808 )
by Austin
04:41 queued 02:35
created
src/SecurityTxtHelper.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
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
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,40 +118,40 @@  discard block
 block discarded – undo
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 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
 block discarded – undo
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
 block discarded – undo
192 192
      */
193 193
     public function clearLogEntries(): self
194 194
     {
195
-        $this->logEntries = [];
195
+        $this->logEntries = [ ];
196 196
 
197 197
         return $this;
198 198
     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         if ($this->cache) {
208 208
             $text = cache($this->cacheKey, null);
209 209
 
210
-            if (! is_null($text)) {
210
+            if (!is_null($text)) {
211 211
                 return $text;
212 212
             }
213 213
         }
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
             ->getText();
218 218
 
219 219
         if ($this->writer->getDebug()) {
220
-            $text .= '# Cache is '.($this->cache ? 'enabled with key "'.$this->cacheKey.'"' : 'disabled').'.'.PHP_EOL.
221
-                     '#'.PHP_EOL;
220
+            $text .= '# Cache is ' . ($this->cache ? 'enabled with key "' . $this->cacheKey . '"' : 'disabled') . '.' . PHP_EOL .
221
+                     '#' . PHP_EOL;
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;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      */
384 384
     public function hasWriter(): bool
385 385
     {
386
-        return ! is_null($this->writer);
386
+        return !is_null($this->writer);
387 387
     }
388 388
 
389 389
     /**
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      */
394 394
     public function getWriter(): Writer
395 395
     {
396
-        if (! $this->hasWriter()) {
396
+        if (!$this->hasWriter()) {
397 397
             throw new Exception('Writer not set.');
398 398
         }
399 399
 
Please login to merge, or discard this patch.
src/SecurityTxtServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/routes/security-txt.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version     v0.3.2
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');
Please login to merge, or discard this patch.
src/SecurityTxtFacade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
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
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.