3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Class MailerBootstrap */ class MailerBootstrap { /** * @var string * Hostname */ private $smtp; /** * @var int * TCP Port for SMTP */ private $port; /** * @var string * SMTP Username */ private $username; /** * @var string * SMTP Password */ private $password; /** * MailerBootstrap constructor. * @param string $smtp * @param int $port * @param string $username * @param string $password * Collects SMTP Info */ public function __construct(string $smtp, int $port, string $username, string $password) { $this->smtp = $smtp; $this->port = $port; $this->username = $username; $this->password = $password; } /** * @return Swift_SmtpTransport * Initializes Swift_SmtpTransport Class */ private function buildTransport(): Swift_SmtpTransport { return (new Swift_SmtpTransport($this->smtp, $this->port)) ->setUsername($this->username) ->setPassword($this->password); } /** * @return Swift_Mailer * Initializes Swift_Mailer Class */ private function buildMailer(): Swift_Mailer { return new Swift_Mailer($this->buildTransport()); } /** * @param string $subject * @param array $from * @param array $to * @param string $body * @return Swift_Message * Builds the Message */ private function buildMessage(?string $subject = null, ?array $from = null, ?array $to = null, ?string $body = null): Swift_Message { return (new Swift_Message($subject)) ->setFrom($from) ->setTo($to) ->setBody($body); } /** * Sends the Message */ public function send(): void { $this->buildMailer()->send($this->buildMessage()); } }
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
18.93 ms | 401 KiB | 8 Q