Completed
Branch master (9d38ea)
by Thomas
05:24 queued 02:40
created

Sendinblue::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Vansteen\Sendinblue;
4
5
use SendinBlue\Client\Configuration;
6
7
/**
8
 * Wrapper for the Sendinblue's Configuration class.
9
 *
10
 * @category Class
11
 * @author   Thomas Van Steenwinckel
12
 * @link     https://github.com/vansteen/sendinblue
13
 */
14
class Sendinblue
15
{
16
    /**
17
     * An instance of the Sendinblue's Configuration class.
18
     * @var \SendinBlue\Client\Configuration
19
     */
20
    protected $configuration;
21
22
    /**
23
     * Constructor.
24
     */
25
    public function __construct()
26
    {
27
        $apikey = config('sendinblue.apikey');
28
        $prefix = config('sendinblue.prefix');
29
30
        // Configure API key authorization: api-key
31
        $this->configuration = Configuration::getDefaultConfiguration()->setApiKey('api-key', $apikey);
32
33
        if ($prefix) {
34
            // Setup prefix (e.g. Bearer) for API key, if needed
35
            $this->configuration->setApiKeyPrefix('api-key', $prefix);
36
        }
37
    }
38
39
    /**
40
     * Gets the default configuration instance.
41
     *
42
     * @return \SendinBlue\Client\Configuration
43
     */
44
    public function getConfiguration()
45
    {
46
        return $this->configuration;
47
    }
48
49
    /**
50
     * Sets the detault configuration instance.
51
     *
52
     * @param \SendinBlue\Client\Configuration $configuration An instance of the Configuration Object
53
     *
54
     * @return void
55
     */
56
    public function setConfiguration(Configuration $configuration)
57
    {
58
        $this->configuration = $configuration;
59
    }
60
}
61