@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * |
212 | 212 | * Should be called just prior to sending the response to the user agent. |
213 | 213 | */ |
214 | - public function finalize(ResponseInterface &$response) |
|
214 | + public function finalize(ResponseInterface & $response) |
|
215 | 215 | { |
216 | 216 | $this->generateNonces($response); |
217 | 217 | $this->buildHeaders($response); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * placeholders with actual nonces, that we'll then add to our |
573 | 573 | * headers. |
574 | 574 | */ |
575 | - protected function generateNonces(ResponseInterface &$response) |
|
575 | + protected function generateNonces(ResponseInterface & $response) |
|
576 | 576 | { |
577 | 577 | $body = $response->getBody(); |
578 | 578 | |
@@ -580,16 +580,16 @@ discard block |
||
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
583 | - if (! is_array($this->styleSrc)) { |
|
583 | + if (!is_array($this->styleSrc)) { |
|
584 | 584 | $this->styleSrc = [$this->styleSrc]; |
585 | 585 | } |
586 | 586 | |
587 | - if (! is_array($this->scriptSrc)) { |
|
587 | + if (!is_array($this->scriptSrc)) { |
|
588 | 588 | $this->scriptSrc = [$this->scriptSrc]; |
589 | 589 | } |
590 | 590 | |
591 | 591 | // Replace style placeholders with nonces |
592 | - $body = preg_replace_callback('/{csp-style-nonce}/', function () { |
|
592 | + $body = preg_replace_callback('/{csp-style-nonce}/', function() { |
|
593 | 593 | $nonce = bin2hex(random_bytes(12)); |
594 | 594 | |
595 | 595 | $this->styleSrc[] = 'nonce-' . $nonce; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | }, $body); |
599 | 599 | |
600 | 600 | // Replace script placeholders with nonces |
601 | - $body = preg_replace_callback('/{csp-script-nonce}/', function () { |
|
601 | + $body = preg_replace_callback('/{csp-script-nonce}/', function() { |
|
602 | 602 | $nonce = bin2hex(random_bytes(12)); |
603 | 603 | |
604 | 604 | $this->scriptSrc[] = 'nonce-' . $nonce; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * Content-Security-Policy and Content-Security-Policy-Report-Only headers |
615 | 615 | * with their values to the response object. |
616 | 616 | */ |
617 | - protected function buildHeaders(ResponseInterface &$response) |
|
617 | + protected function buildHeaders(ResponseInterface & $response) |
|
618 | 618 | { |
619 | 619 | /** |
620 | 620 | * Ensure both headers are available and arrays... |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } |
655 | 655 | |
656 | 656 | foreach ($directives as $name => $property) { |
657 | - if (! empty($this->{$property})) { |
|
657 | + if (!empty($this->{$property})) { |
|
658 | 658 | $this->addToHeader($name, $this->{$property}); |
659 | 659 | } |
660 | 660 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | // Compile our own header strings here since if we just |
663 | 663 | // append it to the response, it will be joined with |
664 | 664 | // commas, not semi-colons as we need. |
665 | - if (! empty($this->tempHeaders)) { |
|
665 | + if (!empty($this->tempHeaders)) { |
|
666 | 666 | $header = ''; |
667 | 667 | |
668 | 668 | foreach ($this->tempHeaders as $name => $value) { |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $response->appendHeader('Content-Security-Policy', $header); |
678 | 678 | } |
679 | 679 | |
680 | - if (! empty($this->reportOnlyHeaders)) { |
|
680 | + if (!empty($this->reportOnlyHeaders)) { |
|
681 | 681 | $header = ''; |
682 | 682 | |
683 | 683 | foreach ($this->reportOnlyHeaders as $name => $value) { |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | $reportSources = []; |
709 | 709 | |
710 | 710 | foreach ($values as $value => $reportOnly) { |
711 | - if (is_numeric($value) && is_string($reportOnly) && ! empty($reportOnly)) { |
|
711 | + if (is_numeric($value) && is_string($reportOnly) && !empty($reportOnly)) { |
|
712 | 712 | $value = $reportOnly; |
713 | 713 | $reportOnly = 0; |
714 | 714 | } |
@@ -722,11 +722,11 @@ discard block |
||
722 | 722 | } |
723 | 723 | } |
724 | 724 | |
725 | - if (! empty($sources)) { |
|
725 | + if (!empty($sources)) { |
|
726 | 726 | $this->tempHeaders[$name] = implode(' ', $sources); |
727 | 727 | } |
728 | 728 | |
729 | - if (! empty($reportSources)) { |
|
729 | + if (!empty($reportSources)) { |
|
730 | 730 | $this->reportOnlyHeaders[$name] = implode(' ', $reportSources); |
731 | 731 | } |
732 | 732 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function __construct(App $config) |
55 | 55 | { |
56 | - if (! is_cli()) { |
|
56 | + if (!is_cli()) { |
|
57 | 57 | throw new RuntimeException(static::class . ' needs to run from the command line.'); // @codeCoverageIgnore |
58 | 58 | } |
59 | 59 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function populateHeaders(): void |
81 | 81 | { |
82 | 82 | $contentType = $_SERVER['CONTENT_TYPE'] ?? getenv('CONTENT_TYPE'); |
83 | - if (! empty($contentType)) { |
|
83 | + if (!empty($contentType)) { |
|
84 | 84 | $this->setHeader('Content-Type', $contentType); |
85 | 85 | } |
86 | 86 | unset($contentType); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $origName = $this->getHeaderName($name); |
144 | 144 | |
145 | 145 | if (isset($this->headers[$origName]) && is_array($this->headers[$origName]->getValue())) { |
146 | - if (! is_array($value)) { |
|
146 | + if (!is_array($value)) { |
|
147 | 147 | $value = [$value]; |
148 | 148 | } |
149 | 149 | |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function setProtocolVersion(string $version): self |
223 | 223 | { |
224 | - if (! is_numeric($version)) { |
|
224 | + if (!is_numeric($version)) { |
|
225 | 225 | $version = substr($version, strpos($version, '/') + 1); |
226 | 226 | } |
227 | 227 | |
228 | 228 | // Make sure that version is in the correct format |
229 | 229 | $version = number_format((float) $version, 1); |
230 | 230 | |
231 | - if (! in_array($version, $this->validProtocolVersions, true)) { |
|
231 | + if (!in_array($version, $this->validProtocolVersions, true)) { |
|
232 | 232 | throw HTTPException::forInvalidHTTPProtocol(implode(', ', $this->validProtocolVersions)); |
233 | 233 | } |
234 | 234 |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | // Sort to get the highest results first |
219 | - usort($results, static function ($a, $b) { |
|
219 | + usort($results, static function($a, $b) { |
|
220 | 220 | if ($a['q'] === $b['q']) { |
221 | 221 | $aAst = substr_count($a['value'], '*'); |
222 | 222 | $bAst = substr_count($b['value'], '*'); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | foreach ($supported['params'] as $label => $value) { |
296 | - if (! isset($acceptable['params'][$label]) |
|
296 | + if (!isset($acceptable['params'][$label]) |
|
297 | 297 | || $acceptable['params'][$label] !== $value |
298 | 298 | ) { |
299 | 299 | return false; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @deprecated $this->proxyIPs property will be removed in the future |
61 | 61 | */ |
62 | 62 | $proxyIPs = $this->proxyIPs ?? config('App')->proxyIPs; |
63 | - if (! empty($proxyIPs) && ! is_array($proxyIPs)) { |
|
63 | + if (!empty($proxyIPs) && !is_array($proxyIPs)) { |
|
64 | 64 | $proxyIPs = explode(',', str_replace(' ', '', $proxyIPs)); |
65 | 65 | } |
66 | 66 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | // e.g. client_ip, proxy_ip1, proxy_ip2, etc. |
75 | 75 | sscanf($spoof, '%[^,]', $spoof); |
76 | 76 | |
77 | - if (! $ipValidator($spoof)) { |
|
77 | + if (!$ipValidator($spoof)) { |
|
78 | 78 | $spoof = null; |
79 | 79 | } else { |
80 | 80 | break; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // We have a subnet ... now the heavy lifting begins |
100 | - if (! isset($separator)) { |
|
100 | + if (!isset($separator)) { |
|
101 | 101 | $separator = $ipValidator($this->ipAddress, 'ipv6') ? ':' : '.'; |
102 | 102 | } |
103 | 103 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // Convert the REMOTE_ADDR IP address to binary, if needed |
110 | - if (! isset($ip, $sprintf)) { |
|
110 | + if (!isset($ip, $sprintf)) { |
|
111 | 111 | if ($separator === ':') { |
112 | 112 | // Make sure we're have the "full" IPv6 format |
113 | 113 | $ip = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($this->ipAddress, ':')), $this->ipAddress)); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - if (! $ipValidator($this->ipAddress)) { |
|
151 | + if (!$ipValidator($this->ipAddress)) { |
|
152 | 152 | return $this->ipAddress = '0.0.0.0'; |
153 | 153 | } |
154 | 154 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | $method = strtolower($method); |
220 | 220 | |
221 | - if (! isset($this->globals[$method])) { |
|
221 | + if (!isset($this->globals[$method])) { |
|
222 | 222 | $this->populateGlobals($method); |
223 | 223 | } |
224 | 224 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | - if (! isset($value)) { |
|
272 | + if (!isset($value)) { |
|
273 | 273 | $value = $this->globals[$method][$index] ?? null; |
274 | 274 | } |
275 | 275 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | ) |
284 | 284 | ) { |
285 | 285 | // Iterate over array and append filter and flags |
286 | - array_walk_recursive($value, static function (&$val) use ($filter, $flags) { |
|
286 | + array_walk_recursive($value, static function(&$val) use ($filter, $flags) { |
|
287 | 287 | $val = filter_var($val, $filter, $flags); |
288 | 288 | }); |
289 | 289 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | protected function populateGlobals(string $method) |
306 | 306 | { |
307 | - if (! isset($this->globals[$method])) { |
|
307 | + if (!isset($this->globals[$method])) { |
|
308 | 308 | $this->globals[$method] = []; |
309 | 309 | } |
310 | 310 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ->where($field, $str) |
98 | 98 | ->limit(1); |
99 | 99 | |
100 | - if (! empty($whereField) && ! empty($whereValue) && ! preg_match('/^\{(\w+)\}$/', $whereValue)) { |
|
100 | + if (!empty($whereField) && !empty($whereValue) && !preg_match('/^\{(\w+)\}$/', $whereValue)) { |
|
101 | 101 | $row = $row->where($whereField, $whereValue); |
102 | 102 | } |
103 | 103 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ->where($field, $str) |
136 | 136 | ->limit(1); |
137 | 137 | |
138 | - if (! empty($ignoreField) && ! empty($ignoreValue) && ! preg_match('/^\{(\w+)\}$/', $ignoreValue)) { |
|
138 | + if (!empty($ignoreField) && !empty($ignoreValue) && !preg_match('/^\{(\w+)\}$/', $ignoreValue)) { |
|
139 | 139 | $row = $row->where("{$ignoreField} !=", $ignoreValue); |
140 | 140 | } |
141 | 141 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function not_in_list(?string $value, string $list): bool |
207 | 207 | { |
208 | - return ! $this->in_list($value, $list); |
|
208 | + return !$this->in_list($value, $list); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $requiredFields = []; |
263 | 263 | |
264 | 264 | foreach ($fields as $field) { |
265 | - if ((array_key_exists($field, $data) && ! empty($data[$field])) || (strpos($field, '.') !== false && ! empty(dot_array_search($field, $data)))) { |
|
265 | + if ((array_key_exists($field, $data) && !empty($data[$field])) || (strpos($field, '.') !== false && !empty(dot_array_search($field, $data)))) { |
|
266 | 266 | $requiredFields[] = $field; |
267 | 267 | } |
268 | 268 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | // Still here? Then we fail this test if |
300 | 300 | // any of the fields are not present in $data |
301 | 301 | foreach ($fields as $field) { |
302 | - if ((strpos($field, '.') === false && (! array_key_exists($field, $data) || empty($data[$field]))) || (strpos($field, '.') !== false && empty(dot_array_search($field, $data)))) { |
|
302 | + if ((strpos($field, '.') === false && (!array_key_exists($field, $data) || empty($data[$field]))) || (strpos($field, '.') !== false && empty(dot_array_search($field, $data)))) { |
|
303 | 303 | return false; |
304 | 304 | } |
305 | 305 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function uploaded(?string $blank, string $name): bool |
48 | 48 | { |
49 | - if (! ($files = $this->request->getFileMultiple($name))) { |
|
49 | + if (!($files = $this->request->getFileMultiple($name))) { |
|
50 | 50 | $files = [$this->request->getFile($name)]; |
51 | 51 | } |
52 | 52 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } else { |
63 | 63 | // Note: cannot unit test this; no way to over-ride ENVIRONMENT? |
64 | 64 | // @codeCoverageIgnoreStart |
65 | - if (! $file->isValid()) { |
|
65 | + if (!$file->isValid()) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | // @codeCoverageIgnoreEnd |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $params = explode(',', $params); |
83 | 83 | $name = array_shift($params); |
84 | 84 | |
85 | - if (! ($files = $this->request->getFileMultiple($name))) { |
|
85 | + if (!($files = $this->request->getFileMultiple($name))) { |
|
86 | 86 | $files = [$this->request->getFile($name)]; |
87 | 87 | } |
88 | 88 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $params = explode(',', $params); |
119 | 119 | $name = array_shift($params); |
120 | 120 | |
121 | - if (! ($files = $this->request->getFileMultiple($name))) { |
|
121 | + if (!($files = $this->request->getFileMultiple($name))) { |
|
122 | 122 | $files = [$this->request->getFile($name)]; |
123 | 123 | } |
124 | 124 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $params = explode(',', $params); |
154 | 154 | $name = array_shift($params); |
155 | 155 | |
156 | - if (! ($files = $this->request->getFileMultiple($name))) { |
|
156 | + if (!($files = $this->request->getFileMultiple($name))) { |
|
157 | 157 | $files = [$this->request->getFile($name)]; |
158 | 158 | } |
159 | 159 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | return true; |
167 | 167 | } |
168 | 168 | |
169 | - if (! in_array($file->getMimeType(), $params, true)) { |
|
169 | + if (!in_array($file->getMimeType(), $params, true)) { |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $params = explode(',', $params); |
185 | 185 | $name = array_shift($params); |
186 | 186 | |
187 | - if (! ($files = $this->request->getFileMultiple($name))) { |
|
187 | + if (!($files = $this->request->getFileMultiple($name))) { |
|
188 | 188 | $files = [$this->request->getFile($name)]; |
189 | 189 | } |
190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return true; |
198 | 198 | } |
199 | 199 | |
200 | - if (! in_array($file->guessExtension(), $params, true)) { |
|
200 | + if (!in_array($file->guessExtension(), $params, true)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $params = explode(',', $params); |
217 | 217 | $name = array_shift($params); |
218 | 218 | |
219 | - if (! ($files = $this->request->getFileMultiple($name))) { |
|
219 | + if (!($files = $this->request->getFileMultiple($name))) { |
|
220 | 220 | $files = [$this->request->getFile($name)]; |
221 | 221 | } |
222 | 222 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if (! empty($errors)) : ?> |
|
1 | +<?php if (!empty($errors)) : ?> |
|
2 | 2 | <div class="errors" role="alert"> |
3 | 3 | <ul> |
4 | 4 | <?php foreach ($errors as $error) : ?> |
@@ -197,14 +197,14 @@ |
||
197 | 197 | $ccNumber = str_replace([' ', '-'], '', $ccNumber); |
198 | 198 | |
199 | 199 | // Non-numeric values cannot be a number...duh |
200 | - if (! is_numeric($ccNumber)) { |
|
200 | + if (!is_numeric($ccNumber)) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
204 | 204 | // Make sure it's a valid length for this card |
205 | 205 | $lengths = explode(',', $info['length']); |
206 | 206 | |
207 | - if (! in_array((string) strlen($ccNumber), $lengths, true)) { |
|
207 | + if (!in_array((string) strlen($ccNumber), $lengths, true)) { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 |