PluginProbe
Media Cloud Sync / 1.3.11
Media Cloud Sync v1.3.11
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / s3 / Aws / S3 / Crypto / HeadersMetadataStrategy.php

HeadersMetadataStrategy.php in Media Cloud Sync 1.3.11, at includes/sdk/s3/Aws/S3/Crypto/HeadersMetadataStrategy.php

49 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws\S3\Crypto;
4
5 use Dudlewebs\WPMCS\s3\Aws\Crypto\MetadataStrategyInterface;
6 use Dudlewebs\WPMCS\s3\Aws\Crypto\MetadataEnvelope;
7 class HeadersMetadataStrategy implements MetadataStrategyInterface
8 {
9 /**
10 * Places the information in the MetadataEnvelope in to the metadata for
11 * the PutObject request of the encrypted object.
12 *
13 * @param MetadataEnvelope $envelope Encryption data to save according to
14 * the strategy.
15 * @param array $args Arguments for PutObject that can be manipulated to
16 * store strategy related information.
17 *
18 * @return array Updated arguments for PutObject.
19 */
20 public function save(MetadataEnvelope $envelope, array $args)
21 {
22 foreach ($envelope as $header => $value) {
23 $args['Metadata'][$header] = $value;
24 }
25 return $args;
26 }
27 /**
28 * Generates a MetadataEnvelope according to the metadata headers from the
29 * GetObject result.
30 *
31 * @param array $args Arguments from Command and Result that contains
32 * S3 Object information, relevant headers, and command
33 * configuration.
34 *
35 * @return MetadataEnvelope
36 */
37 public function load(array $args)
38 {
39 $envelope = new MetadataEnvelope();
40 $constantValues = MetadataEnvelope::getConstantValues();
41 foreach ($constantValues as $constant) {
42 if (!empty($args['Metadata'][$constant])) {
43 $envelope[$constant] = $args['Metadata'][$constant];
44 }
45 }
46 return $envelope;
47 }
48 }
49