Completed
Pull Request — master (#311)
by Alejandro
06:23
created

AppOptions::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Core\Options;
5
6
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
7
use Zend\Stdlib\AbstractOptions;
8
use function sprintf;
9
10
class AppOptions extends AbstractOptions
11
{
12
    use StringUtilsTrait;
13
14
    /** @var string */
15
    private $name = '';
16
    /** @var string */
17
    private $version = '1.0';
18
    /**
19
     * @var string
20
     * @deprecated
21
     */
22
    private $secretKey = '';
23
    /** @var string|null */
24
    private $disableTrackParam;
25
26
    public function getName(): string
27 19
    {
28
        return $this->name;
29 19
    }
30
31
    protected function setName(string $name): self
32
    {
33
        $this->name = $name;
34
        return $this;
35 2
    }
36
37 2
    public function getVersion(): string
38
    {
39
        return $this->version;
40
    }
41
42
    protected function setVersion(string $version): self
43
    {
44 6
        $this->version = $version;
45
        return $this;
46 6
    }
47 6
48
    /**
49
     * @deprecated
50
     */
51
    public function getSecretKey(): string
52
    {
53 2
        return $this->secretKey;
0 ignored issues
show
Deprecated Code introduced by
The property Shlinkio\Shlink\Core\Opt...\AppOptions::$secretKey has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

53
        return /** @scrutinizer ignore-deprecated */ $this->secretKey;
Loading history...
54
    }
55 2
56
    /**
57
     * @deprecated
58
     */
59
    protected function setSecretKey(string $secretKey): self
60
    {
61
        $this->secretKey = $secretKey;
0 ignored issues
show
Deprecated Code introduced by
The property Shlinkio\Shlink\Core\Opt...\AppOptions::$secretKey has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

61
        /** @scrutinizer ignore-deprecated */ $this->secretKey = $secretKey;
Loading history...
62 6
        return $this;
63
    }
64 6
65 6
    /**
66
     * @return string|null
67
     */
68
    public function getDisableTrackParam(): ?string
69
    {
70
        return $this->disableTrackParam;
71 6
    }
72
73 6
    protected function setDisableTrackParam(?string $disableTrackParam): self
74
    {
75
        $this->disableTrackParam = $disableTrackParam;
76
        return $this;
77
    }
78
79
    public function __toString(): string
80 6
    {
81
        return sprintf('%s:v%s', $this->name, $this->version);
82 6
    }
83
}
84