Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
42.86% covered (warning)
42.86%
3 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Google
42.86% covered (warning)
42.86%
3 / 7
0.00% covered (danger)
0.00%
0 / 1
1.19
0.00% covered (danger)
0.00%
0 / 1
 send
42.86% covered (warning)
42.86%
3 / 7
0.00% covered (danger)
0.00%
0 / 1
1.19
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <dev@noladev.com>
8 * @copyright  Copyright (c) 2009-2027 NOLA Interactive, LLC.
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Mail\Transport;
16
17use Google\Service\Gmail;
18use Pop\Http\Client;
19use Pop\Mail\Api\AbstractGoogle;
20use Pop\Mail\Message;
21
22/**
23 * Mailgun API transport class
24 *
25 * @category   Pop
26 * @package    Pop\Mail
27 * @author     Nick Sagona, III <dev@noladev.com>
28 * @copyright  Copyright (c) 2009-2027 NOLA Interactive, LLC.
29 * @license    https://www.popphp.org/license     New BSD License
30 * @version    5.0.0
31 */
32class Google extends AbstractGoogle implements TransportInterface
33{
34
35    /**
36     * Send the message
37     *
38     * @param  Message $message
39     * @return mixed
40     */
41    public function send(Message $message): mixed
42    {
43        $messageObject = new Gmail\Message();
44        $messageObject->setRaw(base64_encode($message->render()));
45
46        $this->verifyToken();
47        $this->client->setAccessToken($this->token);
48
49        $gmail      = new Gmail($this->client);
50        $gmail->users_messages->send($this->username, $messageObject);
51
52        return null;
53    }
54
55}