Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 0% |
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 | public function handle($params = []) |
||
31 | { |
||
32 | $bucketName = $params['bucket']; |
||
33 | |||
34 | try { |
||
35 | $result = $this->client->getConn()->getBucketLifecycle([ |
||
36 | 'Bucket' => $bucketName |
||
37 | ]); |
||
38 | |||
39 | if (null !== $this->commandHandlerLogger) { |
||
40 | $this->commandHandlerLogger->log($this, sprintf('LifeCycleConfiguration of \'%s\' bucket was successfully obtained', $bucketName)); |
||
41 | } |
||
42 | |||
43 | 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 | public function validateParams($params = []) |
||
61 | } |
||
62 | } |
||
63 |