Completed
Pull Request — master (#2)
by
unknown
02:39
created

Acl::setName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace DirectUpload;
4
5
class Acl
6
{
7
8
    private $possibleOptions = [
9
        "private",
10
        "public-read",
11
        "public-read-write",
12
        "aws-exec-read",
13
        "authenticated-read",
14
        "bucket-owner-read",
15
        "bucket-owner-full-control",
16
        "log-delivery-write"
17
    ];
18
19
    private $name;
20
21
    public function __construct($acl)
22
    {
23
        $this->setName($acl);
24
    }
25
26
    public function setName($acl)
27
    {
28
        if (in_array($acl, $this->possibleOptions)) {
29
            $this->name = $acl;
30
        } else {
31
            throw new InvalidAclException;
32
        }
33
    }
34
35
    public function getName()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
36
    {
37
        return $this->name;
38
    }
39
40
}