Debian Codegraph @

lib/3rdParty/composer/aws/aws-sdk-php/src/S3/Crypto/CryptoParamsTraitV2.php

raw symbols SCIP
1 <?php
2 namespace Aws\S3\Crypto;
3
4 use Aws\Crypto\MaterialsProviderInterfaceV2;
5
6 trait CryptoParamsTraitV2
7 {
8 use CryptoParamsTrait;
9
10 protected function getMaterialsProvider(array $args)
11 {
12 if ($args['@MaterialsProvider'] instanceof MaterialsProviderInterfaceV2) {
13 return $args['@MaterialsProvider'];
14 }
15
16 throw new \InvalidArgumentException('An instance of MaterialsProviderInterfaceV2'
17 . ' must be passed in the "MaterialsProvider" field.');
18 }
19
20 protected function getKeyCommitmentPolicy(array $args): string
21 {
22 if (empty($args['@CommitmentPolicy'])) {
23 throw new \InvalidArgumentException('A commitment policy must be'
24 . ' specified in the CommitmentPolicy field.');
25 }
26
27 if (!S3EncryptionClientV2::isSupportedKeyCommitmentPolicy($args['@CommitmentPolicy'])) {
28 throw new \InvalidArgumentException('The CommitmentPolicy requested is not'
29 . ' supported by the SDK.');
30 }
31
32 return $args['@CommitmentPolicy'];
33 }
34 }