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

Acl   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setName() 0 8 2
A getName() 0 4 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
}