*/ private array $sent = []; /** * Whether to report success. * * @var bool */ private bool $succeed; /** * Constructor. * * @param bool $succeed Return value. */ public function __construct( bool $succeed = true ) { $this->succeed = $succeed; } /** * Mailer callable. * * @param string $to Recipient. * @param string $subject Subject. * @param string $body Body. * @param array $headers Headers. * @param array $attachments Attachments. */ public function __invoke( string $to, string $subject, string $body, array $headers = [], array $attachments = [] ): bool { unset( $headers, $attachments ); $this->sent[] = [ 'to' => $to, 'subject' => $subject, 'body' => $body, ]; return $this->succeed; } /** * Captured messages. * * @return list * * @since 0.1.0 */ public function sent(): array { return $this->sent; } /** * Number of sends. * * @since 0.1.0 */ public function count(): int { return count( $this->sent ); } }