8000 Cleanup · symfony/symfony@59a0545 · GitHub
[go: up one dir, main page]

Skip to content

Commit 59a0545

Browse files
committed
Cleanup
1 parent d01c068 commit 59a0545

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/Symfony/Component/Dsn/Configuration/Path.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public function __construct(string $scheme, string $path, array $parameters = []
3737
parent::__construct($scheme, $parameters);
3838
}
3939

40+
public function getScheme(): string
41+
{
42+
return parent::getScheme();
43+
}
44+
4045
public function getPath(): string
4146
{
4247
return $this->path;
@@ -49,6 +54,10 @@ public function __toString()
4954
{
5055
$parameters = $this->getParameters();
5156

52-
return sprintf('%s://%s%s%s', $this->getScheme(), $this->getUserInfoString(), $this->getPath(), empty($parameters) ? '' : '?'.http_build_query($parameters));
57+
return
58+
$this->getScheme().'://'.
59+
$this->getUserInfoString().
60+
$this->getPath().
61+
(empty($parameters) ? '' : '?'.http_build_query($parameters));
5362
}
5463
}

src/Symfony/Component/Dsn/Configuration/Url.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
* Example:
2020
* - memcached://user:password@127.0.0.1?weight=50
21+
* - 127.0.0.1:80
22+
* - amqp://127.0.0.1/%2f/messages
2123
*
2224
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2325
*/
@@ -70,7 +72,14 @@ public function getPath(): ?string
7072
public function __toString()
7173
{
7274
$parameters = $this->getParameters();
75+
$scheme = $this->getScheme();
7376

74-
return sprintf('%s://%s%s%s%s', $this->getScheme(), $this->getUserInfoString(), $this->getHost(), empty($this->port) ? '' : ':'.$this->port, empty($parameters) ? '' : '?'.http_build_query($parameters));
77+
return
78+
(empty($scheme) ? '' : $scheme.'://').
79+
$this->getUserInfoString() .
80+
$this->getHost().
81+
(empty($this->port) ? '' : ':'.$this->port).
82+
($this->getPath() ?? '').
83+
(empty($parameters) ? '' : '?'.http_build_query($parameters));
7584
}
7685
}

0 commit comments

Comments
 (0)
0