@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->stream = new Stream($streamOrFile); |
93 | 93 | } elseif ($streamOrFile instanceof StreamInterface) { |
94 | 94 | $this->stream = $streamOrFile; |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | throw new InvalidArgumentException( |
97 | 97 | 'Invalid stream or file provided for UploadedFile' |
98 | 98 | ); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $this->moved = PHP_SAPI === 'cli' |
174 | 174 | ? rename($this->file, $targetPath) |
175 | 175 | : move_uploaded_file($this->file, $targetPath); |
176 | - } else { |
|
176 | + }else { |
|
177 | 177 | Utils::copyToStream( |
178 | 178 | $this->getStream(), |
179 | 179 | new LazyOpenStream($targetPath, 'w') |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | private $headers = []; |
17 | 17 | |
18 | 18 | /** @var array<string, string> Map of lowercase header name => original name at registration */ |
19 | - private $headerNames = []; |
|
19 | + private $headerNames = []; |
|
20 | 20 | |
21 | 21 | /** @var string */ |
22 | 22 | private $protocol = '1.1'; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (isset($new->headerNames[$normalized])) { |
95 | 95 | $header = $this->headerNames[$normalized]; |
96 | 96 | $new->headers[$header] = array_merge($this->headers[$header], $value); |
97 | - } else { |
|
97 | + }else { |
|
98 | 98 | $new->headerNames[$normalized] = $header; |
99 | 99 | $new->headers[$header] = $value; |
100 | 100 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (isset($this->headerNames[$normalized])) { |
155 | 155 | $header = $this->headerNames[$normalized]; |
156 | 156 | $this->headers[$header] = array_merge($this->headers[$header], $value); |
157 | - } else { |
|
157 | + }else { |
|
158 | 158 | $this->headerNames[$normalized] = $header; |
159 | 159 | $this->headers[$header] = $value; |
160 | 160 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | private function trimAndValidateHeaderValues(array $values): array |
197 | 197 | { |
198 | - return array_map(function ($value) { |
|
198 | + return array_map(function($value) { |
|
199 | 199 | if (!is_scalar($value) && null !== $value) { |
200 | 200 | throw new \InvalidArgumentException(sprintf( |
201 | 201 | 'Header value must be scalar or null but %s provided.', |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | )); |
225 | 225 | } |
226 | 226 | |
227 | - if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { |
|
227 | + if (!preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { |
|
228 | 228 | throw new \InvalidArgumentException( |
229 | 229 | sprintf( |
230 | 230 | '"%s" is not valid header name', |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | // Clients must not send a request with line folding and a server sending folded headers is |
258 | 258 | // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting |
259 | 259 | // folding is not likely to break any legitimate use case. |
260 | - if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) { |
|
260 | + if (!preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) { |
|
261 | 261 | throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value)); |
262 | 262 | } |
263 | 263 | } |
@@ -167,7 +167,7 @@ |
||
167 | 167 | $stream->rewind(); |
168 | 168 | } catch (\Exception $e) { |
169 | 169 | throw new \RuntimeException('Unable to seek stream ' |
170 | - . $i . ' of the AppendStream', 0, $e); |
|
170 | + . $i.' of the AppendStream', 0, $e); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $target = '/'; |
70 | 70 | } |
71 | 71 | if ($this->uri->getQuery() != '') { |
72 | - $target .= '?' . $this->uri->getQuery(); |
|
72 | + $target .= '?'.$this->uri->getQuery(); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $target; |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | if (($port = $this->uri->getPort()) !== null) { |
134 | - $host .= ':' . $port; |
|
134 | + $host .= ':'.$port; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | if (isset($this->headerNames['host'])) { |
138 | 138 | $header = $this->headerNames['host']; |
139 | - } else { |
|
139 | + }else { |
|
140 | 140 | $header = 'Host'; |
141 | 141 | $this->headerNames['host'] = 'Host'; |
142 | 142 | } |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | if ($urlEncoding === true) { |
29 | - $decoder = function ($value) { |
|
29 | + $decoder = function($value) { |
|
30 | 30 | return rawurldecode(str_replace('+', ' ', (string) $value)); |
31 | 31 | }; |
32 | 32 | } elseif ($urlEncoding === PHP_QUERY_RFC3986) { |
33 | 33 | $decoder = 'rawurldecode'; |
34 | 34 | } elseif ($urlEncoding === PHP_QUERY_RFC1738) { |
35 | 35 | $decoder = 'urldecode'; |
36 | - } else { |
|
37 | - $decoder = function ($str) { |
|
36 | + }else { |
|
37 | + $decoder = function($str) { |
|
38 | 38 | return $str; |
39 | 39 | }; |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $value = isset($parts[1]) ? $decoder($parts[1]) : null; |
46 | 46 | if (!array_key_exists($key, $result)) { |
47 | 47 | $result[$key] = $value; |
48 | - } else { |
|
48 | + }else { |
|
49 | 49 | if (!is_array($result[$key])) { |
50 | 50 | $result[$key] = [$result[$key]]; |
51 | 51 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if ($encoding === false) { |
78 | - $encoder = function (string $str): string { |
|
78 | + $encoder = function(string $str): string { |
|
79 | 79 | return $str; |
80 | 80 | }; |
81 | 81 | } elseif ($encoding === PHP_QUERY_RFC3986) { |
82 | 82 | $encoder = 'rawurlencode'; |
83 | 83 | } elseif ($encoding === PHP_QUERY_RFC1738) { |
84 | 84 | $encoder = 'urlencode'; |
85 | - } else { |
|
85 | + }else { |
|
86 | 86 | throw new \InvalidArgumentException('Invalid type'); |
87 | 87 | } |
88 | 88 | |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | $qs .= $k; |
94 | 94 | $v = is_bool($v) ? (int) $v : $v; |
95 | 95 | if ($v !== null) { |
96 | - $qs .= '=' . $encoder((string) $v); |
|
96 | + $qs .= '='.$encoder((string) $v); |
|
97 | 97 | } |
98 | 98 | $qs .= '&'; |
99 | - } else { |
|
99 | + }else { |
|
100 | 100 | foreach ($v as $vv) { |
101 | 101 | $qs .= $k; |
102 | 102 | $vv = is_bool($vv) ? (int) $vv : $vv; |
103 | 103 | if ($vv !== null) { |
104 | - $qs .= '=' . $encoder((string) $vv); |
|
104 | + $qs .= '='.$encoder((string) $vv); |
|
105 | 105 | } |
106 | 106 | $qs .= '&'; |
107 | 107 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | break; |
55 | 55 | } |
56 | 56 | } |
57 | - } else { |
|
57 | + }else { |
|
58 | 58 | $remaining = $maxLen; |
59 | 59 | while ($remaining > 0 && !$source->eof()) { |
60 | 60 | $buf = $source->read(min($bufferSize, $remaining)); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | if (!isset($changes['uri'])) { |
167 | 167 | $uri = $request->getUri(); |
168 | - } else { |
|
168 | + }else { |
|
169 | 169 | // Remove the host header if one is on the URI |
170 | 170 | if ($host = $changes['uri']->getHost()) { |
171 | 171 | $changes['set_headers']['Host'] = $host; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $standardPorts = ['http' => 80, 'https' => 443]; |
175 | 175 | $scheme = $changes['uri']->getScheme(); |
176 | 176 | if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { |
177 | - $changes['set_headers']['Host'] .= ':' . $port; |
|
177 | + $changes['set_headers']['Host'] .= ':'.$port; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($resource instanceof StreamInterface) { |
315 | 315 | return $resource; |
316 | 316 | } elseif ($resource instanceof \Iterator) { |
317 | - return new PumpStream(function () use ($resource) { |
|
317 | + return new PumpStream(function() use ($resource) { |
|
318 | 318 | if (!$resource->valid()) { |
319 | 319 | return false; |
320 | 320 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | return new PumpStream($resource, $options); |
335 | 335 | } |
336 | 336 | |
337 | - throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); |
|
337 | + throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | public static function tryFopen(string $filename, string $mode) |
354 | 354 | { |
355 | 355 | $ex = null; |
356 | - set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool { |
|
356 | + set_error_handler(static function(int $errno, string $errstr) use ($filename, $mode, &$ex): bool { |
|
357 | 357 | $ex = new \RuntimeException(sprintf( |
358 | 358 | 'Unable to open "%s" using mode "%s": %s', |
359 | 359 | $filename, |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | public static function tryGetContents($stream): string |
401 | 401 | { |
402 | 402 | $ex = null; |
403 | - set_error_handler(static function (int $errno, string $errstr) use (&$ex): bool { |
|
403 | + set_error_handler(static function(int $errno, string $errstr) use (&$ex): bool { |
|
404 | 404 | $ex = new \RuntimeException(sprintf( |
405 | 405 | 'Unable to read stream contents: %s', |
406 | 406 | $errstr |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function __construct($username, $password, $options = array()) |
21 | 21 | { |
22 | - $auth = 'Authorization: Basic ' . \base64_encode("$username:$password"); |
|
22 | + $auth = 'Authorization: Basic '.\base64_encode("$username:$password"); |
|
23 | 23 | $host = 'https://email.twilio.com'; |
24 | 24 | parent::__construct($auth, $host, $options); |
25 | 25 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $headers = [ |
35 | 35 | $auth, |
36 | - 'User-Agent: sendgrid/' . $this->version . ';php', |
|
36 | + 'User-Agent: sendgrid/'.$this->version.';php', |
|
37 | 37 | 'Accept: application/json', |
38 | 38 | ]; |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $version = isset($options['version']) ? $options['version'] : '/v3'; |
43 | 43 | |
44 | 44 | if (!empty($options['impersonateSubuser'])) { |
45 | - $headers[] = 'On-Behalf-Of: ' . $options['impersonateSubuser']; |
|
45 | + $headers[] = 'On-Behalf-Of: '.$options['impersonateSubuser']; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->client = new Client($host, $headers, $version); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function verifySignature($publicKey, $payload, $signature, $timestamp) |
40 | 40 | { |
41 | - $timestampedPayload = $timestamp . $payload; |
|
41 | + $timestampedPayload = $timestamp.$payload; |
|
42 | 42 | $decodedSignature = Signature::fromBase64($signature); |
43 | 43 | |
44 | 44 | return Ecdsa::verify($timestampedPayload, $decodedSignature, $publicKey); |