AuthorizationTrait::setAuthorization()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Nexylan packages.
5
 *
6
 * (c) Nexylan SAS <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Nexy\PayboxDirect\Request;
13
14
use Symfony\Component\Validator\Constraints as Assert;
15
16
/**
17
 * @author Sullivan Senechal <[email protected]>
18
 */
19
trait AuthorizationTrait
20
{
21
    /**
22
     * @var string|null
23
     *
24
     * @Assert\Length(min=1, max=10)
25
     */
26
    private $authorization = null;
27
28
    /**
29
     * @param string|null $authorization
30
     *
31
     * @return $this
32
     */
33
    final public function setAuthorization($authorization = null)
34
    {
35
        $this->authorization = $authorization;
36
37
        return $this;
38
    }
39
40
    /**
41
     * @return bool
42
     */
43
    final protected function hasAuthorization()
44
    {
45
        return !empty($this->authorization);
46
    }
47
48
    /**
49
     * @return string|null
50
     */
51
    final protected function getAuthorization()
52
    {
53
        return $this->authorization;
54
    }
55
}
56