Completed
Push — master ( 9ab4b9...065cdd )
by Alejandro
09:44
created

AppOptions   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 90
ccs 16
cts 20
cp 0.8
rs 10
wmc 8
lcom 0
cbo 2

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
A setName() 0 5 1
A getVersion() 0 4 1
A setVersion() 0 5 1
A getSecretKey() 0 4 1
A setSecretKey() 0 5 1
A __toString() 0 4 1
1
<?php
2
namespace Shlinkio\Shlink\Core\Options;
3
4
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
5
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
6
use Zend\Stdlib\AbstractOptions;
7
8
class AppOptions extends AbstractOptions
9
{
10
    use StringUtilsTrait;
11
12
    /**
13
     * @var string
14
     */
15
    protected $name = '';
16
    /**
17
     * @var string
18
     */
19
    protected $version = '1.0';
20
    /**
21
     * @var string
22
     */
23
    protected $secretKey = '';
24
25
    /**
26
     * AppOptions constructor.
27
     * @param array|null|\Traversable $options
28
     *
29
     * @Inject({"config.app_options"})
30
     */
31 6
    public function __construct($options = null)
32
    {
33 6
        parent::__construct($options);
34 6
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function getName()
40
    {
41
        return $this->name;
42
    }
43
44
    /**
45
     * @param string $name
46
     * @return $this
47
     */
48 6
    protected function setName($name)
49
    {
50 6
        $this->name = $name;
51 6
        return $this;
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getVersion()
58
    {
59
        return $this->version;
60
    }
61
62
    /**
63
     * @param string $version
64
     * @return $this
65
     */
66 6
    protected function setVersion($version)
67
    {
68 6
        $this->version = $version;
69 6
        return $this;
70
    }
71
72
    /**
73
     * @return mixed
74
     */
75 6
    public function getSecretKey()
76
    {
77 6
        return $this->secretKey;
78
    }
79
80
    /**
81
     * @param mixed $secretKey
82
     * @return $this
83
     */
84 6
    protected function setSecretKey($secretKey)
85
    {
86 6
        $this->secretKey = $secretKey;
87 6
        return $this;
88
    }
89
90
    /**
91
     * @return string
92
     */
93 1
    public function __toString()
94
    {
95 1
        return sprintf('%s:v%s', $this->name, $this->version);
96
    }
97
}
98