@@ -81,6 +81,9 @@ |
||
| 81 | 81 | return $this->options; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $name |
|
| 86 | + */ |
|
| 84 | 87 | public function get($name) |
| 85 | 88 | { |
| 86 | 89 | if (!array_key_exists($name, $this->options)) { |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | $this->options['acl'] = new Acl($this->options['acl']); |
| 103 | 103 | |
| 104 | 104 | // Return HTTP code must be a string |
| 105 | - $this->options['success_status'] = (string)$this->options['success_status']; |
|
| 105 | + $this->options['success_status'] = (string) $this->options['success_status']; |
|
| 106 | 106 | |
| 107 | 107 | // Encryption option is just a helper to set this header, but we need to set it early on so it |
| 108 | 108 | // affects both the policy and the inputs generated. |
@@ -121,24 +121,24 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $separator = (substr($url, -1) === "/" ? "" : "/"); |
| 123 | 123 | |
| 124 | - return $url . $separator . urlencode($this->bucket); |
|
| 124 | + return $url.$separator.urlencode($this->bucket); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | private function buildAmazonUrl(): string |
| 128 | 128 | { |
| 129 | - $region = (string)$this->region; |
|
| 129 | + $region = (string) $this->region; |
|
| 130 | 130 | |
| 131 | 131 | // Only the us-east-1 region is exempt from needing the region in the url. |
| 132 | 132 | if ($region !== "us-east-1") { |
| 133 | - $middle = "-" . $region; |
|
| 133 | + $middle = "-".$region; |
|
| 134 | 134 | } else { |
| 135 | 135 | $middle = ""; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if ($this->options->get('accelerate')) { |
| 139 | - return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com"; |
|
| 139 | + return "//".urlencode($this->bucket).".".self::SERVICE."-accelerate.amazonaws.com"; |
|
| 140 | 140 | } else { |
| 141 | - return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket); |
|
| 141 | + return "//".self::SERVICE.$middle.".amazonaws.com"."/".urlencode($this->bucket); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | $inputs = [ |
| 195 | 195 | 'Content-Type' => $this->options->get('content_type'), |
| 196 | - 'acl' => (string)$this->options->get('acl'), |
|
| 196 | + 'acl' => (string) $this->options->get('acl'), |
|
| 197 | 197 | 'success_action_status' => $this->options->get('success_status'), |
| 198 | 198 | 'policy' => $this->base64Policy, |
| 199 | 199 | 'X-amz-credential' => $this->credentials, |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if ($addKey) { |
| 208 | 208 | // Note: The Key (filename) will need to be populated with JS on upload |
| 209 | 209 | // if anything other than the filename is wanted. |
| 210 | - $inputs['key'] = $this->options->get('valid_prefix') . $this->options->get('default_filename'); |
|
| 210 | + $inputs['key'] = $this->options->get('valid_prefix').$this->options->get('default_filename'); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | return $inputs; |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | { |
| 225 | 225 | $inputs = []; |
| 226 | 226 | foreach ($this->getFormInputs($addKey) as $name => $value) { |
| 227 | - $inputs[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; |
|
| 227 | + $inputs[] = '<input type="hidden" name="'.$name.'" value="'.$value.'" />'; |
|
| 228 | 228 | } |
| 229 | 229 | return implode(PHP_EOL, $inputs); |
| 230 | 230 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | 'expiration' => $this->getExpirationDate(), |
| 257 | 257 | 'conditions' => [ |
| 258 | 258 | ['bucket' => $this->bucket], |
| 259 | - ['acl' => (string)$this->options->get('acl')], |
|
| 259 | + ['acl' => (string) $this->options->get('acl')], |
|
| 260 | 260 | ['starts-with', '$key', $this->options->get('valid_prefix')], |
| 261 | 261 | $this->getPolicyContentTypeArray(), |
| 262 | 262 | ['content-length-range', 0, $this->mbToBytes($this->options->get('max_file_size'))], |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | private function addAdditionalInputs($policy): array |
| 284 | 284 | { |
| 285 | 285 | foreach ($this->options->get('additional_inputs') as $name => $value) { |
| 286 | - $policy['conditions'][] = ['starts-with', '$' . $name, $value]; |
|
| 286 | + $policy['conditions'][] = ['starts-with', '$'.$name, $value]; |
|
| 287 | 287 | } |
| 288 | 288 | return $policy; |
| 289 | 289 | } |
@@ -295,14 +295,14 @@ discard block |
||
| 295 | 295 | { |
| 296 | 296 | $signatureData = [ |
| 297 | 297 | $this->getShortDateFormat(), |
| 298 | - (string)$this->region, |
|
| 298 | + (string) $this->region, |
|
| 299 | 299 | self::SERVICE, |
| 300 | 300 | self::REQUEST_TYPE |
| 301 | 301 | ]; |
| 302 | 302 | |
| 303 | 303 | // Iterates over the data (defined in the array above), hashing it each time. |
| 304 | - $initial = 'AWS4' . $this->secret; |
|
| 305 | - $signingKey = array_reduce($signatureData, function ($key, $data) { |
|
| 304 | + $initial = 'AWS4'.$this->secret; |
|
| 305 | + $signingKey = array_reduce($signatureData, function($key, $data) { |
|
| 306 | 306 | return $this->keyHash($data, $key); |
| 307 | 307 | }, $initial); |
| 308 | 308 | |