targetPartSizeBytes = $targetPartSizeBytes; $this->multipartUploadThresholdBytes = $multipartUploadThresholdBytes; $this->requestChecksumCalculation = $requestChecksumCalculation; $this->responseChecksumValidation = $responseChecksumValidation; $this->multipartDownloadType = $multipartDownloadType; $this->concurrency = $concurrency; $this->trackProgress = $trackProgress; $this->defaultRegion = $defaultRegion; } /** $config: * - target_part_size_bytes: (int, default=(8388608 `8MB`)) * The minimum part size to be used in a multipart upload/download. * - multipart_upload_threshold_bytes: (int, default=(16777216 `16 MB`)) * The threshold to decided whether a multipart upload is needed. * - request_checksum_calculation: (string, default=`when_supported`) * To decide whether a checksum validation will be applied to the response. * - response_checksum_validation: (string, default=`when_supported`) * - multipart_download_type: (string, default='part') * The download type to be used in a multipart download. * - concurrency: (int, default=5) * Maximum number of concurrent operations allowed during a multipart * upload/download. * - track_progress: (bool, default=false) * To enable progress tracker in a multipart upload/download, and or * a directory upload/download operation. * - default_region: (string, default="us-east-2") */ public static function fromArray(array $config): self { return new self( $config['target_part_size_bytes'] ?? self::DEFAULT_TARGET_PART_SIZE_BYTES, $config['multipart_upload_threshold_bytes'] ?? self::DEFAULT_MULTIPART_UPLOAD_THRESHOLD_BYTES, $config['request_checksum_calculation'] ?? self::DEFAULT_REQUEST_CHECKSUM_CALCULATION, $config['response_checksum_validation'] ?? self::DEFAULT_RESPONSE_CHECKSUM_VALIDATION, $config['multipart_download_type'] ?? self::DEFAULT_MULTIPART_DOWNLOAD_TYPE, $config['concurrency'] ?? self::DEFAULT_CONCURRENCY, $config['track_progress'] ?? self::DEFAULT_TRACK_PROGRESS, $config['default_region'] ?? null ); } /** * @return int */ public function getTargetPartSizeBytes(): int { return $this->targetPartSizeBytes; } /** * @return int */ public function getMultipartUploadThresholdBytes(): int { return $this->multipartUploadThresholdBytes; } /** * @return string */ public function getRequestChecksumCalculation(): string { return $this->requestChecksumCalculation; } /** * @return string */ public function getResponseChecksumValidation(): string { return $this->responseChecksumValidation; } /** * @return string */ public function getMultipartDownloadType(): string { return $this->multipartDownloadType; } /** * @return int */ public function getConcurrency(): int { return $this->concurrency; } /** * @return bool */ public function isTrackProgress(): bool { return $this->trackProgress; } /** * @return string|null */ public function getDefaultRegion(): ?string { return $this->defaultRegion; } /** * @return array */ public function toArray(): array { return [ 'target_part_size_bytes' => $this->targetPartSizeBytes, 'multipart_upload_threshold_bytes' => $this->multipartUploadThresholdBytes, 'request_checksum_calculation' => $this->requestChecksumCalculation, 'response_checksum_validation' => $this->responseChecksumValidation, 'multipart_download_type' => $this->multipartDownloadType, 'concurrency' => $this->concurrency, 'track_progress' => $this->trackProgress, 'default_region' => $this->defaultRegion, ]; } }