Total Complexity | 15 |
Total Lines | 96 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | class Dsn |
||
15 | { |
||
16 | /** |
||
17 | * @var string|null |
||
18 | */ |
||
19 | private $scheme; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $parameters = []; |
||
25 | |||
26 | public function __construct(?string $scheme, array $parameters = []) |
||
30 | } |
||
31 | |||
32 | public function getScheme(): ?string |
||
35 | } |
||
36 | |||
37 | public function withScheme(?string $scheme): self |
||
38 | { |
||
39 | $new = clone $this; |
||
40 | $new->scheme = $scheme; |
||
41 | |||
42 | return $new; |
||
43 | } |
||
44 | |||
45 | public function getParameters(): array |
||
46 | { |
||
47 | return $this->parameters; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param mixed|null $default |
||
52 | * |
||
53 | * @return mixed |
||
54 | */ |
||
55 | public function getParameter(string $key, $default = null) |
||
56 | { |
||
57 | return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param mixed $value |
||
62 | */ |
||
63 | public function withParameter(string $key, $value): self |
||
64 | { |
||
65 | $new = clone $this; |
||
66 | $new->parameters[$key] = $value; |
||
67 | |||
68 | return $new; |
||
69 | } |
||
70 | |||
71 | public function withoutParameter(string $key): self |
||
72 | { |
||
73 | $new = clone $this; |
||
74 | unset($new->parameters[$key]); |
||
75 | |||
76 | return $new; |
||
77 | } |
||
78 | |||
79 | public function getHost(): ?string |
||
80 | { |
||
81 | return null; |
||
82 | } |
||
83 | |||
84 | public function getPort(): ?int |
||
85 | { |
||
86 | return null; |
||
87 | } |
||
88 | |||
89 | public function getPath(): ?string |
||
90 | { |
||
91 | return null; |
||
92 | } |
||
93 | |||
94 | public function getUser(): ?string |
||
95 | { |
||
96 | return null; |
||
97 | } |
||
98 | |||
99 | public function getPassword(): ?string |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * @var string |
||
106 | */ |
||
107 | public function __toString() |
||
108 | { |
||
110 | } |
||
111 | } |
||
112 |