Test Failed
Push — master ( a92e12...446184 )
by Domenico
04:27
created

HasBucket   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 26
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 1
A validateParams() 0 3 1
1
<?php
2
/**
3
 *  This file is part of the Simple S3 package.
4
 *
5
 * (c) Mauro Cassani<https://github.com/mauretto78>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
namespace Matecat\SimpleS3\Commands\Handlers;
13
14
use Matecat\SimpleS3\Commands\CommandHandler;
15
16
class HasBucket extends CommandHandler
17
{
18
    /**
19
     * Check if a bucket already exists.
20
     * For a complete reference:
21
     * https://docs.aws.amazon.com/cli/latest/reference/s3api/head-bucket.html
22
     *
23
     * @param array $params
24
     *
25
     * @return bool
26
     */
27 22
    public function handle($params = [])
28
    {
29 22
        $bucketName = $params['bucket'];
30
31 22
        return $this->client->getConn()->doesBucketExist($bucketName);
32
    }
33
34
    /**
35
     * @param array $params
36
     *
37
     * @return bool
38
     */
39 22
    public function validateParams($params = [])
40
    {
41 22
        return isset($params['bucket']);
42
    }
43
}
44