Completed
Pull Request — master (#16)
by
unknown
08:02
created
src/Signature.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     private $time = null;
93 93
 	
94
-	/**
94
+    /**
95 95
      * @var bool use AWS Accelerate
96 96
      */
97 97
     private $accelerate = false;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $this->bucket = $bucket;
118 118
         $this->region = new Region($region);
119 119
 		
120
-		$this->accelerate = $accelerate;
120
+        $this->accelerate = $accelerate;
121 121
 
122 122
         $this->setOptions($options);
123 123
     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
 
168 168
         $separator = (substr($url, -1) === "/" ? "" : "/");
169 169
 
170
-        return $url . $separator . urlencode($this->bucket);
170
+        return $url.$separator.urlencode($this->bucket);
171 171
     }
172 172
 
173 173
     private function buildAmazonUrl()
174 174
     {
175
-        $region = (string)$this->region;
175
+        $region = (string) $this->region;
176 176
 
177 177
         // Only the us-east-1 region is exempt from needing the region in the url.
178 178
         if ($region !== "us-east-1") {
179
-            $middle = "-" . $region;
179
+            $middle = "-".$region;
180 180
         } else {
181 181
             $middle = "";
182 182
         }
183 183
 
184
-        if($this->accelerate)
185
-            return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com";
184
+        if ($this->accelerate)
185
+            return "//".urlencode($this->bucket).".".self::SERVICE."-accelerate.amazonaws.com";
186 186
         else
187
-            return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket);
187
+            return "//".self::SERVICE.$middle.".amazonaws.com"."/".urlencode($this->bucket);
188 188
     }
189 189
 
190 190
     /**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $this->options['acl'] = new Acl($this->options['acl']);
211 211
 
212 212
         // Return HTTP code must be a string
213
-        $this->options['success_status'] = (string)$this->options['success_status'];
213
+        $this->options['success_status'] = (string) $this->options['success_status'];
214 214
     }
215 215
 
216 216
     /**
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
         $inputs = [
244 244
             'Content-Type' => $this->options['content_type'],
245
-            'acl' => (string)$this->options['acl'],
245
+            'acl' => (string) $this->options['acl'],
246 246
             'success_action_status' => $this->options['success_status'],
247 247
             'policy' => $this->base64Policy,
248 248
             'X-amz-credential' => $this->credentials,
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         if ($addKey) {
261 261
             // Note: The Key (filename) will need to be populated with JS on upload
262 262
             // if anything other than the filename is wanted.
263
-            $inputs['key'] = $this->options['valid_prefix'] . $this->options['default_filename'];
263
+            $inputs['key'] = $this->options['valid_prefix'].$this->options['default_filename'];
264 264
         }
265 265
 
266 266
         return $inputs;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     {
278 278
         $inputs = [];
279 279
         foreach ($this->getFormInputs($addKey) as $name => $value) {
280
-            $inputs[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
280
+            $inputs[] = '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
281 281
         }
282 282
         return implode(PHP_EOL, $inputs);
283 283
     }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             'expiration' => $this->getExpirationDate(),
310 310
             'conditions' => [
311 311
                 ['bucket' => $this->bucket],
312
-                ['acl' => (string)$this->options['acl']],
312
+                ['acl' => (string) $this->options['acl']],
313 313
                 ['starts-with', '$key', $this->options['valid_prefix']],
314 314
                 $this->getPolicyContentTypeArray(),
315 315
                 ['content-length-range', 0, $this->mbToBytes($this->options['max_file_size'])],
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     private function addAdditionalInputs($policy)
337 337
     {
338 338
         foreach ($this->options['additional_inputs'] as $name => $value) {
339
-            $policy['conditions'][] = ['starts-with', '$' . $name, $value];
339
+            $policy['conditions'][] = ['starts-with', '$'.$name, $value];
340 340
         }
341 341
         return $policy;
342 342
     }
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
     {
349 349
         $signatureData = [
350 350
             $this->getShortDateFormat(),
351
-            (string)$this->region,
351
+            (string) $this->region,
352 352
             self::SERVICE,
353 353
             self::REQUEST_TYPE
354 354
         ];
355 355
 
356 356
         // Iterates over the data (defined in the array above), hashing it each time.
357
-        $initial = 'AWS4' . $this->secret;
357
+        $initial = 'AWS4'.$this->secret;
358 358
         $signingKey = array_reduce($signatureData, function($key, $data) {
359 359
             return $this->keyHash($data, $key);
360 360
         }, $initial);
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -181,10 +181,11 @@
 block discarded – undo
181 181
             $middle = "";
182 182
         }
183 183
 
184
-        if($this->accelerate)
185
-            return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com";
186
-        else
187
-            return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket);
184
+        if($this->accelerate) {
185
+                    return "//" . urlencode($this->bucket) . "." . self::SERVICE . "-accelerate.amazonaws.com";
186
+        } else {
187
+                    return "//" . self::SERVICE . $middle . ".amazonaws.com" . "/" . urlencode($this->bucket);
188
+        }
188 189
     }
189 190
 
190 191
     /**
Please login to merge, or discard this patch.