| Conditions | 3 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.512 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 2 | public function handle(array $params = []): ?string |
|
| 29 | { |
||
| 30 | 2 | $bucketName = $params[ 'bucket' ]; |
|
| 31 | 2 | $keyName = $params[ 'key' ]; |
|
| 32 | |||
| 33 | try { |
||
| 34 | 2 | $url = $this->client->getPublicItemLink(['bucket' => $bucketName, 'key' => $keyName]); |
|
| 35 | 2 | $content = File::loadFile($url, $this->client->hasSslVerify()); |
|
| 36 | |||
| 37 | 2 | if (false === $content) { |
|
| 38 | $this->commandHandlerLogger?->log($this, sprintf('Something went wrong during getting content of \'%s\' item from \'%s\' bucket', $keyName, $bucketName), 'warning'); |
||
| 39 | |||
| 40 | return null; |
||
| 41 | } |
||
| 42 | |||
| 43 | 2 | $this->commandHandlerLogger?->log($this, sprintf('Content from \'%s\' item was successfully obtained from \'%s\' bucket', $keyName, $bucketName)); |
|
| 44 | |||
| 45 | 2 | return $content; |
|
|
|
|||
| 46 | } catch (Exception $e) { |
||
| 47 | $this->commandHandlerLogger?->logExceptionAndReturnFalse($e); |
||
| 48 | |||
| 49 | throw $e; |
||
| 50 | } |
||
| 66 |