Completed
Push — master ( f479a1...1e7185 )
by Thomas
04:03
created

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