/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Notifier/Bridge/Pushover/PushoverTransportFactory.php
42 строки
1 KB
Charly Goblet
[Notifier] Add Pushover bridge
23 фев 2023, 17:45
23 фев 2023, 17:45
0f07fd5
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Notifier\Bridge\Pushover; use Symfony\Component\Notifier\Exception\UnsupportedSchemeException; use Symfony\Component\Notifier\Transport\AbstractTransportFactory; use Symfony\Component\Notifier\Transport\Dsn; use Symfony\Component\Notifier\Transport\TransportInterface; /** * @author mocodo <https://github.com/mocodo> */ final class PushoverTransportFactory extends AbstractTransportFactory { public function create(Dsn $dsn): TransportInterface { if ('pushover' !== $dsn->getScheme()) { throw new UnsupportedSchemeException($dsn, 'pushover', $this->getSupportedSchemes()); } $userKey = $dsn->getUser(); $appToken = $dsn->getPassword(); $host = 'default' === $dsn->getHost() ? null : $dsn->getHost(); $port = $dsn->getPort(); return (new PushoverTransport($userKey, $appToken, $this->client, $this->dispatcher))->setHost($host)->setPort($port); } protected function getSupportedSchemes(): array { return ['pushover']; } }