Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@..
Decoded Output download
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Notifier\Bridge\Mercure;
use Symfony\Component\Mercure\Exception\InvalidArgumentException;
use Symfony\Component\Mercure\HubRegistry;
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
use Symfony\Component\Notifier\Exception\UnsupportedSchemeException;
use Symfony\Component\Notifier\Transport\AbstractTransportFactory;
use Symfony\Component\Notifier\Transport\Dsn;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author Mathias Arlaud <[email protected]>
*/
final class MercureTransportFactory extends AbstractTransportFactory
{
private HubRegistry $registry;
public function __construct(HubRegistry $registry, ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null)
{
parent::__construct($dispatcher, $client);
$this->registry = $registry;
}
public function create(Dsn $dsn): MercureTransport
{
if ('mercure' !== $dsn->getScheme()) {
throw new UnsupportedSchemeException($dsn, 'mercure', $this->getSupportedSchemes());
}
$hubId = $dsn->getHost();
$topic = $dsn->getOption('topic');
try {
$hub = $this->registry->getHub($hubId);
} catch (InvalidArgumentException) {
throw new IncompleteDsnException(sprintf('Hub "%s" not found. Did you mean one of: "%s"?', $hubId, implode('", "', array_keys($this->registry->all()))));
}
return new MercureTransport($hub, $hubId, $topic, $this->client, $this->dispatcher);
}
protected function getSupportedSchemes(): array
{
return ['mercure'];
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Notifier\Bridge\Mercure;
use Symfony\Component\Mercure\Exception\InvalidArgumentException;
use Symfony\Component\Mercure\HubRegistry;
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
use Symfony\Component\Notifier\Exception\UnsupportedSchemeException;
use Symfony\Component\Notifier\Transport\AbstractTransportFactory;
use Symfony\Component\Notifier\Transport\Dsn;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author Mathias Arlaud <[email protected]>
*/
final class MercureTransportFactory extends AbstractTransportFactory
{
private HubRegistry $registry;
public function __construct(HubRegistry $registry, ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null)
{
parent::__construct($dispatcher, $client);
$this->registry = $registry;
}
public function create(Dsn $dsn): MercureTransport
{
if ('mercure' !== $dsn->getScheme()) {
throw new UnsupportedSchemeException($dsn, 'mercure', $this->getSupportedSchemes());
}
$hubId = $dsn->getHost();
$topic = $dsn->getOption('topic');
try {
$hub = $this->registry->getHub($hubId);
} catch (InvalidArgumentException) {
throw new IncompleteDsnException(sprintf('Hub "%s" not found. Did you mean one of: "%s"?', $hubId, implode('", "', array_keys($this->registry->all()))));
}
return new MercureTransport($hub, $hubId, $topic, $this->client, $this->dispatcher);
}
protected function getSupportedSchemes(): array
{
return ['mercure'];
}
}
Function Calls
None |
Stats
MD5 | d5877add5e719e375d1bbf8894cb7aa8 |
Eval Count | 0 |
Decode Time | 109 ms |