Total Complexity | 11 |
Total Lines | 94 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
17 | class Url extends Dsn |
||
18 | { |
||
19 | use UserPasswordTrait; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $host; |
||
25 | |||
26 | /** |
||
27 | * @var int|null |
||
28 | */ |
||
29 | private $port; |
||
30 | |||
31 | /** |
||
32 | * @var string|null |
||
33 | */ |
||
34 | private $path; |
||
35 | |||
36 | /** |
||
37 | * @param array{ user?: string|null, password?: string|null, } $authentication |
||
|
|||
38 | */ |
||
39 | public function __construct(?string $scheme, string $host, ?int $port = null, ?string $path = null, array $parameters = [], array $authentication = []) |
||
46 | } |
||
47 | |||
48 | public function getHost(): string |
||
49 | { |
||
50 | return $this->host; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return static |
||
55 | */ |
||
56 | public function withHost(string $host) |
||
57 | { |
||
58 | $new = clone $this; |
||
59 | $new->host = $host; |
||
60 | |||
61 | return $new; |
||
62 | } |
||
63 | |||
64 | public function getPort(): ?int |
||
65 | { |
||
66 | return $this->port; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return static |
||
71 | */ |
||
72 | public function withPort(?int $port) |
||
73 | { |
||
74 | $new = clone $this; |
||
75 | $new->port = $port; |
||
76 | |||
77 | return $new; |
||
78 | } |
||
79 | |||
80 | public function getPath(): ?string |
||
81 | { |
||
82 | return $this->path; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return static |
||
87 | */ |
||
88 | public function withPath(?string $path) |
||
89 | { |
||
90 | $new = clone $this; |
||
91 | $new->path = $path; |
||
92 | |||
93 | return $new; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | public function __toString() |
||
111 | } |
||
112 | } |
||
113 |