PKzZ䌻pttRunProcessContext.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Process\Messenger; use Symfony\Component\Process\Process; /** * @author Kevin Bond */ final class RunProcessContext { public readonly ?int $exitCode; public readonly ?string $output; public readonly ?string $errorOutput; public function __construct( public readonly RunProcessMessage $message, Process $process, ) { $this->exitCode = $process->getExitCode(); $this->output = $process->isOutputDisabled() ? null : $process->getOutput(); $this->errorOutput = $process->isOutputDisabled() ? null : $process->getErrorOutput(); } } PKzZ^|RunProcessMessageHandler.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Process\Messenger; use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Exception\RunProcessFailedException; use Symfony\Component\Process\Process; /** * @author Kevin Bond */ final class RunProcessMessageHandler { public function __invoke(RunProcessMessage $message): RunProcessContext { $process = new Process($message->command, $message->cwd, $message->env, $message->input, $message->timeout); try { return new RunProcessContext($message, $process->mustRun()); } catch (ProcessFailedException $e) { throw new RunProcessFailedException($e, new RunProcessContext($message, $e->getProcess())); } } } PKzZQRunProcessMessage.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Process\Messenger; /** * @author Kevin Bond */ class RunProcessMessage implements \Stringable { public function __construct( public readonly array $command, public readonly ?string $cwd = null, public readonly ?array $env = null, public readonly mixed $input = null, public readonly ?float $timeout = 60.0, ) { } public function __toString(): string { return implode(' ', $this->command); } } PKZmrRunCommandMessage.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Messenger; use Symfony\Component\Console\Exception\RunCommandFailedException; /** * @author Kevin Bond */ class RunCommandMessage implements \Stringable { /** * @param bool $throwOnFailure If the command has a non-zero exit code, throw {@see RunCommandFailedException} * @param bool $catchExceptions @see Application::setCatchExceptions() */ public function __construct( public readonly string $input, public readonly bool $throwOnFailure = true, public readonly bool $catchExceptions = false, ) { } public function __toString(): string { return $this->input; } } PKZb7&&RunCommandContext.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Messenger; /** * @author Kevin Bond */ final class RunCommandContext { public function __construct( public readonly RunCommandMessage $message, public readonly int $exitCode, public readonly string $output, ) { } } PKZ޴t++RunCommandMessageHandler.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Messenger; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\RunCommandFailedException; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\BufferedOutput; /** * @author Kevin Bond */ final class RunCommandMessageHandler { public function __construct(private readonly Application $application) { } public function __invoke(RunCommandMessage $message): RunCommandContext { $input = new StringInput($message->input); $output = new BufferedOutput(); $this->application->setCatchExceptions($message->catchExceptions); try { $exitCode = $this->application->run($input, $output); } catch (\Throwable $e) { throw new RunCommandFailedException($e, new RunCommandContext($message, Command::FAILURE, $output->fetch())); } if ($message->throwOnFailure && Command::SUCCESS !== $exitCode) { throw new RunCommandFailedException(sprintf('Command "%s" exited with code "%s".', $message->input, $exitCode), new RunCommandContext($message, $exitCode, $output->fetch())); } return new RunCommandContext($message, $exitCode, $output->fetch()); } } PKZ&ZZSendEmailMessage.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mailer\Messenger; use Symfony\Component\Mailer\Envelope; use Symfony\Component\Mime\RawMessage; /** * @author Fabien Potencier */ class SendEmailMessage { private RawMessage $message; private ?Envelope $envelope; public function __construct(RawMessage $message, Envelope $envelope = null) { $this->message = $message; $this->envelope = $envelope; } public function getMessage(): RawMessage { return $this->message; } public function getEnvelope(): ?Envelope { return $this->envelope; } } PKZNhMessageHandler.phpnuW+A * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mailer\Messenger; use Symfony\Component\Mailer\SentMessage; use Symfony\Component\Mailer\Transport\TransportInterface; /** * @author Fabien Potencier */ class MessageHandler { private TransportInterface $transport; public function __construct(TransportInterface $transport) { $this->transport = $transport; } public function __invoke(SendEmailMessage $message): ?SentMessage { return $this->transport->send($message->getMessage(), $message->getEnvelope()); } } PKzZ䌻pttRunProcessContext.phpnuW+APKzZ^|RunProcessMessageHandler.phpnuW+APKzZQRunProcessMessage.phpnuW+APKZmr* RunCommandMessage.phpnuW+APKZb7&&RunCommandContext.phpnuW+APKZ޴t++RunCommandMessageHandler.phpnuW+APKZ&ZZSendEmailMessage.phpnuW+APKZNhMessageHandler.phpnuW+APK