| Conditions | 4 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function handle(array $params = []): bool |
||
| 31 | { |
||
| 32 | $bucketName = $params[ 'bucket' ]; |
||
| 33 | |||
| 34 | try { |
||
| 35 | $accelerate = $this->client->getConn()->putBucketAccelerateConfiguration( |
||
| 36 | [ |
||
| 37 | 'AccelerateConfiguration' => [ |
||
| 38 | 'Status' => 'Enabled', |
||
| 39 | ], |
||
| 40 | 'Bucket' => $bucketName, |
||
| 41 | ] |
||
| 42 | ); |
||
| 43 | |||
| 44 | if (($accelerate instanceof ResultInterface) and $accelerate[ '@metadata' ][ 'statusCode' ] === 200) { |
||
| 45 | $this->commandHandlerLogger?->log($this, sprintf('Bucket \'%s\' was successfully set to transfer accelerated mode', $bucketName)); |
||
| 46 | |||
| 47 | 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 |