| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function handle($params = []) |
||
| 28 | { |
||
| 29 | $bucketName = $params['bucket']; |
||
| 30 | $size = 0; |
||
| 31 | |||
| 32 | $items = $this->client->getItemsInABucket([ |
||
| 33 | 'bucket' => $bucketName, |
||
| 34 | 'prefix' => (isset($params['prefix'])) ? $params['prefix'] : null, |
||
| 35 | 'hydrate' => true |
||
| 36 | ]); |
||
| 37 | |||
| 38 | /** @var ResultInterface $item */ |
||
| 39 | foreach ($items as $key => $item) { |
||
| 40 | $size += $item['ContentLength']; |
||
| 41 | } |
||
| 42 | |||
| 43 | if (null !== $this->commandHandlerLogger) { |
||
| 44 | $this->commandHandlerLogger->log($this, sprintf('Size of \'%s\' bucket was successfully obtained', $bucketName)); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $size; |
||
| 48 | } |
||
| 60 |