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