Completed
Pull Request — master (#17)
by
unknown
01:21
created
src/Signature.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -163,24 +163,24 @@  discard block
 block discarded – undo
163 163
 
164 164
         $separator = (substr($url, -1) === "/" ? "" : "/");
165 165
 
166
-        return $url . $separator . urlencode($this->bucket);
166
+        return $url.$separator.urlencode($this->bucket);
167 167
     }
168 168
 
169 169
     private function buildAmazonUrl()
170 170
     {
171
-        $region = (string)$this->region;
171
+        $region = (string) $this->region;
172 172
 
173 173
         // Only the us-east-1 region is exempt from needing the region in the url.
174 174
         if ($region !== "us-east-1") {
175
-            $middle = "-" . $region;
175
+            $middle = "-".$region;
176 176
         } else {
177 177
             $middle = "";
178 178
         }
179 179
 
180
-        if($this->options['accelerate'])
181
-            return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com";
180
+        if ($this->options['accelerate'])
181
+            return "//".urlencode($this->bucket).".".self::SERVICE."-accelerate.amazonaws.com";
182 182
         else
183
-            return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket);
183
+            return "//".self::SERVICE.$middle.".amazonaws.com"."/".urlencode($this->bucket);
184 184
     }
185 185
 
186 186
     /**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $this->options['acl'] = new Acl($this->options['acl']);
207 207
 
208 208
         // Return HTTP code must be a string
209
-        $this->options['success_status'] = (string)$this->options['success_status'];
209
+        $this->options['success_status'] = (string) $this->options['success_status'];
210 210
     }
211 211
 
212 212
     /**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
         $inputs = [
240 240
             'Content-Type' => $this->options['content_type'],
241
-            'acl' => (string)$this->options['acl'],
241
+            'acl' => (string) $this->options['acl'],
242 242
             'success_action_status' => $this->options['success_status'],
243 243
             'policy' => $this->base64Policy,
244 244
             'X-amz-credential' => $this->credentials,
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         if ($addKey) {
257 257
             // Note: The Key (filename) will need to be populated with JS on upload
258 258
             // if anything other than the filename is wanted.
259
-            $inputs['key'] = $this->options['valid_prefix'] . $this->options['default_filename'];
259
+            $inputs['key'] = $this->options['valid_prefix'].$this->options['default_filename'];
260 260
         }
261 261
 
262 262
         return $inputs;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     {
274 274
         $inputs = [];
275 275
         foreach ($this->getFormInputs($addKey) as $name => $value) {
276
-            $inputs[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
276
+            $inputs[] = '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
277 277
         }
278 278
         return implode(PHP_EOL, $inputs);
279 279
     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             'expiration' => $this->getExpirationDate(),
306 306
             'conditions' => [
307 307
                 ['bucket' => $this->bucket],
308
-                ['acl' => (string)$this->options['acl']],
308
+                ['acl' => (string) $this->options['acl']],
309 309
                 ['starts-with', '$key', $this->options['valid_prefix']],
310 310
                 $this->getPolicyContentTypeArray(),
311 311
                 ['content-length-range', 0, $this->mbToBytes($this->options['max_file_size'])],
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     private function addAdditionalInputs($policy)
333 333
     {
334 334
         foreach ($this->options['additional_inputs'] as $name => $value) {
335
-            $policy['conditions'][] = ['starts-with', '$' . $name, $value];
335
+            $policy['conditions'][] = ['starts-with', '$'.$name, $value];
336 336
         }
337 337
         return $policy;
338 338
     }
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
     {
345 345
         $signatureData = [
346 346
             $this->getShortDateFormat(),
347
-            (string)$this->region,
347
+            (string) $this->region,
348 348
             self::SERVICE,
349 349
             self::REQUEST_TYPE
350 350
         ];
351 351
 
352 352
         // Iterates over the data (defined in the array above), hashing it each time.
353
-        $initial = 'AWS4' . $this->secret;
353
+        $initial = 'AWS4'.$this->secret;
354 354
         $signingKey = array_reduce($signatureData, function($key, $data) {
355 355
             return $this->keyHash($data, $key);
356 356
         }, $initial);
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,10 +177,11 @@
 block discarded – undo
177 177
             $middle = "";
178 178
         }
179 179
 
180
-        if($this->options['accelerate'])
181
-            return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com";
182
-        else
183
-            return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket);
180
+        if($this->options['accelerate']) {
181
+                    return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com";
182
+        } else {
183
+                    return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket);
184
+        }
184 185
     }
185 186
 
186 187
     /**
Please login to merge, or discard this patch.