404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.147.49.19: ~ $
<?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\Mailer\Transport;

use Symfony\Component\Mailer\Envelope;
use Symfony\Component\Mailer\Exception\InvalidArgumentException;
use Symfony\Component\Mailer\Exception\LogicException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\RawMessage;

/**
 * @author Fabien Potencier <fabien@symfony.com>
 */
final class Transports implements TransportInterface
{
    /**
     * @var array<string, TransportInterface>
     */
    private array $transports = [];
    private TransportInterface $default;

    /**
     * @param iterable<string, TransportInterface> $transports
     */
    public function __construct(iterable $transports)
    {
        foreach ($transports as $name => $transport) {
            $this->default ??= $transport;
            $this->transports[$name] = $transport;
        }

        if (!$this->transports) {
            throw new LogicException(sprintf('"%s" must have at least one transport configured.', __CLASS__));
        }
    }

    public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
    {
        /** @var Message $message */
        if (RawMessage::class === $message::class || !$message->getHeaders()->has('X-Transport')) {
            return $this->default->send($message, $envelope);
        }

        $headers = $message->getHeaders();
        $transport = $headers->get('X-Transport')->getBody();
        $headers->remove('X-Transport');

        if (!isset($this->transports[$transport])) {
            throw new InvalidArgumentException(sprintf('The "%s" transport does not exist (available transports: "%s").', $transport, implode('", "', array_keys($this->transports))));
        }

        try {
            return $this->transports[$transport]->send($message, $envelope);
        } catch (\Throwable $e) {
            $headers->addTextHeader('X-Transport', $transport);

            throw $e;
        }
    }

    public function __toString(): string
    {
        return '['.implode(',', array_keys($this->transports)).']';
    }
}

Filemanager

Name Type Size Permission Actions
Smtp Folder 0755
AbstractApiTransport.php File 1.55 KB 0644
AbstractHttpTransport.php File 2.12 KB 0644
AbstractTransport.php File 3.9 KB 0644
AbstractTransportFactory.php File 1.59 KB 0644
Dsn.php File 2.45 KB 0644
FailoverTransport.php File 971 B 0644
NativeTransportFactory.php File 2 KB 0644
NullTransport.php File 654 B 0644
NullTransportFactory.php File 861 B 0644
RoundRobinTransport.php File 3.61 KB 0644
SendmailTransport.php File 4.2 KB 0644
SendmailTransportFactory.php File 967 B 0644
TransportFactoryInterface.php File 719 B 0644
TransportInterface.php File 913 B 0644
Transports.php File 2.27 KB 0644