Completed
Push — master ( aaff7d...f806fe )
by Sullivan
03:03
created

AuthorizationTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setAuthorization() 0 6 1
A getAuthorization() 0 4 1
A hasAuthorization() 0 4 1
1
<?php
2
3
namespace Nexy\PayboxDirect\Request;
4
5
use Symfony\Component\Validator\Constraints as Assert;
6
7
/**
8
 * @author Sullivan Senechal <[email protected]>
9
 */
10
trait AuthorizationTrait
11
{
12
    /**
13
     * @var string|null
14
     *
15
     * @Assert\Length(min=1, max=10)
16
     */
17
    private $authorization = null;
18
19
    /**
20
     * @param string|null $authorization
21
     *
22
     * @return $this
23
     */
24
    final public function setAuthorization($authorization = null)
25
    {
26
        $this->authorization = $authorization;
27
28
        return $this;
29
    }
30
31
    /**
32
     * @return bool
33
     */
34
    final protected function hasAuthorization()
35
    {
36
        return !empty($this->authorization);
37
    }
38
39
    /**
40
     * @return string|null
41
     */
42
    final protected function getAuthorization()
43
    {
44
        return $this->authorization;
45
    }
46
}
47