PHP 7.4.33
Preview: CryptoParamsTrait.php Size: 2.58 KB
/home/godevadmin/www/admin/vendor/aws/Aws/S3/Crypto/CryptoParamsTrait.php

<?php
namespace Aws\S3\Crypto;

use Aws\Crypto\MaterialsProvider;
use Aws\Crypto\MetadataEnvelope;
use Aws\Crypto\MetadataStrategyInterface;

trait CryptoParamsTrait
{
    protected function getMaterialsProvider(array $args)
    {
        if ($args['@MaterialsProvider'] instanceof MaterialsProvider) {
            return $args['@MaterialsProvider'];
        }

        throw new \InvalidArgumentException('An instance of MaterialsProvider'
            . ' must be passed in the "MaterialsProvider" field.');
    }

    protected function getInstructionFileSuffix(array $args)
    {
        return !empty($args['@InstructionFileSuffix'])
            ? $args['@InstructionFileSuffix']
            : $this->instructionFileSuffix;
    }

    protected function determineGetObjectStrategy(
        $result,
        $instructionFileSuffix
    ) {
        if (isset($result['Metadata'][MetadataEnvelope::CONTENT_KEY_V2_HEADER])) {
            return new HeadersMetadataStrategy();
        }

        return new InstructionFileMetadataStrategy(
            $this->client,
            $instructionFileSuffix
        );
    }

    protected function getMetadataStrategy(array $args, $instructionFileSuffix)
    {
        if (!empty($args['@MetadataStrategy'])) {
            if ($args['@MetadataStrategy'] instanceof MetadataStrategyInterface) {
                return $args['@MetadataStrategy'];
            }

            if (is_string($args['@MetadataStrategy'])) {
                switch ($args['@MetadataStrategy']) {
                    case HeadersMetadataStrategy::class:
                        return new HeadersMetadataStrategy();
                    case InstructionFileMetadataStrategy::class:
                        return new InstructionFileMetadataStrategy(
                            $this->client,
                            $instructionFileSuffix
                        );
                    default:
                        throw new \InvalidArgumentException('Could not match the'
                            . ' specified string in "MetadataStrategy" to a'
                            . ' predefined strategy.');
                }
            } else {
                throw new \InvalidArgumentException('The metadata strategy that'
                    . ' was passed to "MetadataStrategy" was unrecognized.');
            }
        } elseif ($instructionFileSuffix) {
            return new InstructionFileMetadataStrategy(
                $this->client,
                $instructionFileSuffix
            );
        }

        return null;
    }
}

Directory Contents

Dirs: 0 × Files: 9

Name Size Perms Modified Actions
2.58 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
524 B lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
1.64 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
2.98 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
13.75 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
18.36 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
6.81 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
7.44 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
999 B lrwxrwxr-x 2024-06-18 20:10:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).