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