| Total Complexity | 3 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 75% |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | class GetBucketLifeCycleConfiguration extends CommandHandler |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Get the lifecycle configuration of a bucket. |
||
| 23 | * For a complete reference: |
||
| 24 | * https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-lifecycle-configuration.html |
||
| 25 | * |
||
| 26 | * @param array $params |
||
| 27 | * |
||
| 28 | * @return Result |
||
| 29 | * @throws Exception |
||
| 30 | */ |
||
| 31 | 1 | public function handle(array $params = []): Result |
|
| 32 | { |
||
| 33 | 1 | $bucketName = $params[ 'bucket' ]; |
|
| 34 | |||
| 35 | try { |
||
| 36 | 1 | $result = $this->client->getConn()->getBucketLifecycle([ |
|
| 37 | 1 | 'Bucket' => $bucketName |
|
| 38 | 1 | ]); |
|
| 39 | |||
| 40 | 1 | $this->commandHandlerLogger?->log($this, sprintf('LifeCycleConfiguration of \'%s\' bucket was successfully obtained', $bucketName)); |
|
| 41 | |||
| 42 | 1 | return $result; |
|
| 43 | } catch (S3Exception $e) { |
||
| 44 | $this->commandHandlerLogger?->logExceptionAndReturnFalse($e); |
||
| 45 | |||
| 46 | throw $e; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param array $params |
||
| 52 | * |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | 1 | public function validateParams(array $params = []): bool |
|
| 58 | } |
||
| 59 | } |
||
| 60 |