Passed
Pull Request — master (#128)
by
unknown
03:15
created

SendinblueAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendMail() 0 17 2
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.0
13
 */
14
15
namespace Quantum\Libraries\Mailer\Adapters;
16
17
use Quantum\Libraries\Mailer\MailerInterface;
18
use Quantum\Libraries\Curl\HttpClient;
19
20
class SendinblueAdapter implements MailerInterface
21
{    
22
    /**
23
     * Send mail by using Sendinblue
24
     * @param  string $data
25
     * @return bool
26
     */
27
    public function sendMail($data)
28
    {
29
        try {
30
            $httpClient = new HttpClient();
31
            $httpClient->createMultiRequest()
32
                ->createRequest('https://api.sendinblue.com/v3/smtp/email')
33
                ->setMethod('POST')
34
                ->setHeaders([
0 ignored issues
show
Bug introduced by
The method setHeaders() does not exist on Quantum\Libraries\Curl\HttpClient. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
                ->/** @scrutinizer ignore-call */ setHeaders([
Loading history...
35
                    'Accept' => 'application/json',
36
                    'api-key' => config()->get('mailer.sendinblue.api_key'),
37
                    'content-type' => 'application/json'
38
                ])
39
                ->setData($data)
40
                ->start();
41
            return true;
42
        } catch (\Exception $e) {
43
            return false;
44
        }
45
    }
46
}
47