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

HasBucket::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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