8000 feature #34747 [Notifier] Added possibility to extract path from prov… · symfony/symfony@753d4a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 753d4a2

Browse files
committed
feature #34747 [Notifier] Added possibility to extract path from provided DSN (espectrio)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Notifier] Added possibility to extract path from provided DSN | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #34746 | License | MIT I'm currently working on Microsoft Teams Webhook Notifier (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook), and there is no way to provide DSN for it, because of missing parse_url()['path'] option It looks like `teams://outlook.office.com/webhook/{uuid}@{uuid}/IncomingWebhook/{id}/{uuid}` and I'd like to be able to build Notifier Transport endpoint from it Commits ------- ab9b49b [Notifier] Added possibility to extract path from provided DSN
2 parents 626999c + ab9b49b commit 753d4a2

File tree

1 file changed

+10
-2
lines changed
  • src/Symfony/Component/Notifier/Transport

1 file changed

+10
-2
lines changed

src/Symfony/Component/Notifier/Transport/Dsn.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ final class Dsn
2626
private $password;
2727
private $port;
2828
private $options;
29+
private $path;
2930

30-
public function __construct(string $scheme, string $host, ?string $user = null, ?string $password = null, ?int $port = null, array $options = [])
31+
public function __construct(string $scheme, string $host, ?string $user = null, ?string $password = null, ?int $port = null, array $options = [], ?string $path = null)
3132
{
3233
$this->scheme = $scheme;
3334
$this->host = $host;
3435
$this->user = $user;
3536
$this->password = $password;
3637
$this->port = $port;
3738
$this->options = $options;
39+
$this->path = $path;
3840
}
3941

4042
public static function fromString(string $dsn): self
@@ -54,9 +56,10 @@ public static function fromString(string $dsn): self
5456
$user = isset($parsedDsn['user']) ? urldecode($parsedDsn['user']) : null;
5557
$password = isset($parsedDsn['pass']) ? urldecode($parsedDsn['pass']) : null;
5658
$port = $parsedDsn['port'] ?? null;
59+
$path = $parsedDsn['path'] ?? null;
5760
parse_str($parsedDsn['query'] ?? '', $query);
5861

59-
return new self($parsedDsn['scheme'], $parsedDsn['host'], $user, $password, $port, $query);
62+
return new self($parsedDsn['scheme'], $parsedDsn['host'], $user, $password, $port, $query, $path);
6063
}
6164

6265
public function getScheme(): string
@@ -88,4 +91,9 @@ public function getOption(string $key, $default = null)
8891
{
8992
return $this->options[$key] ?? $default;
9093
}
94+
95+
public function getPath(): ?string
96+
{
97+
return $this->path;
98+
}
9199
}

0 commit comments

Comments
 (0)
0