| Conditions | 4 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4.343 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 1 | public function handle(array $params = []): bool |
|
| 31 | { |
||
| 32 | 1 | $bucketName = $params[ 'bucket' ]; |
|
| 33 | |||
| 34 | try { |
||
| 35 | 1 | $accelerate = $this->client->getConn()->putBucketAccelerateConfiguration( |
|
| 36 | 1 | [ |
|
| 37 | 1 | 'AccelerateConfiguration' => [ |
|
| 38 | 1 | 'Status' => 'Enabled', |
|
| 39 | 1 | ], |
|
| 40 | 1 | 'Bucket' => $bucketName, |
|
| 41 | 1 | ] |
|
| 42 | 1 | ); |
|
| 43 | |||
| 44 | 1 | if (($accelerate instanceof ResultInterface) and $accelerate[ '@metadata' ][ 'statusCode' ] === 200) { |
|
| 45 | 1 | $this->commandHandlerLogger?->log($this, sprintf('Bucket \'%s\' was successfully set to transfer accelerated mode', $bucketName)); |
|
| 46 | |||
| 47 | 1 | return true; |
|
| 48 | } |
||
| 49 | |||
| 50 | $this->commandHandlerLogger?->log($this, sprintf('Something went wrong during setting of bucket \'%s\' to transfer accelerated mode', $bucketName), 'warning'); |
||
| 51 | |||
| 52 | return false; |
||
| 53 | } catch (Exception $e) { |
||
| 54 | $this->commandHandlerLogger?->logExceptionAndReturnFalse($e); |
||
| 55 | |||
| 56 | throw $e; |
||
| 57 | } |
||
| 70 |