Passed
Push — v7 ( ba093b...24d66b )
by Georges
02:14
created

Config::isSaslUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Geolim4
5
 * Date: 12/02/2018
6
 * Time: 23:10
7
 */
8
9
namespace Phpfastcache\Drivers\Memcached;
10
11
use Phpfastcache\Config\ConfigurationOption;
12
13
class Config extends ConfigurationOption
14
{
15
    /**
16
     * @var array
17
     */
18
    protected $servers = [
19
      [
20
        'host' => '127.0.0.1',
21
        'port' => 11211,
22
        'saslUser' => false,
23
        'saslPassword' => false,
24
      ],
25
    ];
26
27
    /**
28
     * @var string
29
     */
30
    protected $host = '127.0.0.1';
31
32
    /**
33
     * @var int
34
     */
35
    protected $port = 11211;
36
37
    /**
38
     * @var bool
39
     */
40
    protected $saslUser = '';
41
42
    /**
43
     * @var bool
44
     */
45
    protected $saslPassword = '';
46
47
    /**
48
     * @return bool
49
     */
50
    public function getSaslUser(): string
51
    {
52
        return $this->saslUser;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->saslUser returns the type boolean which is incompatible with the type-hinted return string.
Loading history...
53
    }
54
55
    /**
56
     * @param string $saslUser
57
     * @return self
58
     */
59
    public function setSaslUser(string $saslUser): self
60
    {
61
        $this->saslUser = $saslUser;
0 ignored issues
show
Documentation Bug introduced by
The property $saslUser was declared of type boolean, but $saslUser is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
62
        return $this;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getSaslPassword(): string
69
    {
70
        return $this->saslPassword;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->saslPassword returns the type boolean which is incompatible with the type-hinted return string.
Loading history...
71
    }
72
73
    /**
74
     * @param string $saslPassword
75
     * @return self
76
     */
77
    public function setSaslPassword(string $saslPassword): self
78
    {
79
        $this->saslPassword = $saslPassword;
0 ignored issues
show
Documentation Bug introduced by
The property $saslPassword was declared of type boolean, but $saslPassword is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
80
        return $this;
81
    }
82
83
    /**
84
     * @return array
85
     */
86
    public function getServers(): array
87
    {
88
        return $this->servers;
89
    }
90
91
    /**
92
     * @param array $servers
93
     * @return self
94
     */
95
    public function setServers(array $servers): self
96
    {
97
        $this->servers = $servers;
98
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function getHost(): string
105
    {
106
        return $this->host;
107
    }
108
109
    /**
110
     * @param string $host
111
     * @return self
112
     */
113
    public function setHost(string $host): self
114
    {
115
        $this->host = $host;
116
        return $this;
117
    }
118
119
    /**
120
     * @return int
121
     */
122
    public function getPort(): int
123
    {
124
        return $this->port;
125
    }
126
127
    /**
128
     * @param int $port
129
     * @return Config
130
     */
131
    public function setPort(int $port): self
132
    {
133
        $this->port = $port;
134
        return $this;
135
    }
136
}