Credentials::getPassword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BenTools\SimpleDBAL\Model;
4
5
use BenTools\SimpleDBAL\Contract\CredentialsInterface;
6
7
class Credentials implements CredentialsInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $hostname;
13
14
    /**
15
     * @var string
16
     */
17
    private $user;
18
19
    /**
20
     * @var string
21
     */
22
    private $password;
23
24
    /**
25
     * @var string
26
     */
27
    private $database;
28
29
    /**
30
     * @var string
31
     */
32
    private $platform;
33
34
    /**
35
     * @var string
36
     */
37
    private $port;
38
39
    /**
40
     * Credentials constructor.
41
     * @param string $hostname
42
     * @param string $user
43
     * @param string|null $password
44
     * @param string|null $database
45
     * @param string $platform
46
     * @param int $port
47
     */
48
    public function __construct(string $hostname, string $user, string $password = null, string $database = null, string $platform = 'mysql', int $port = 3306)
49
    {
50
        $this->hostname = $hostname;
51
        $this->user = $user;
52
        $this->password = $password;
53
        $this->database = $database;
54
        $this->platform = $platform;
55
        $this->port = $port;
0 ignored issues
show
Documentation Bug introduced by
The property $port was declared of type string, but $port is of type integer. 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...
56
    }
57
58
    /**
59
     * @inheritdoc
60
     */
61
    public function getHostname(): string
62
    {
63
        return $this->hostname;
64
    }
65
66
    /**
67
     * @inheritdoc
68
     */
69
    public function getUser(): string
70
    {
71
        return $this->user;
72
    }
73
74
    /**
75
     * @inheritdoc
76
     */
77
    public function getPassword(): ?string
78
    {
79
        return $this->password;
80
    }
81
82
    /**
83
     * @inheritdoc
84
     */
85
    public function getDatabase(): ?string
86
    {
87
        return $this->database;
88
    }
89
90
    /**
91
     * @inheritdoc
92
     */
93
    public function getPlatform(): string
94
    {
95
        return $this->platform;
96
    }
97
98
    /**
99
     * @inheritdoc
100
     */
101
    public function getPort(): int
102
    {
103
        return $this->port;
104
    }
105
}
106