Response::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * This file is part of the theroadbunch/mandrill-sdk package.
5
 *
6
 * (c) Dan McAdams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RoadBunch\Mandrill;
13
14
15
/**
16
 * Class Response
17
 *
18
 * @author  Dan McAdams
19
 * @package RoadBunch\Mandrill
20
 */
21
class Response
22
{
23
    /**
24
     * The response provided from the mandrill sdk is an array
25
     * we'll just store it in here for now
26
     *
27
     * @var array $response
28
     */
29
    protected $response;
30
31
    /**
32
     * Response constructor.
33
     *
34
     * @param array $mandrillResponse
35
     */
36
    public function __construct(array $mandrillResponse)
37
    {
38
        $this->response = $mandrillResponse;
39
    }
40
41
    /**
42
     * @param string $index
43
     *
44
     * @return mixed
45
     */
46
    public function get(string $index)
47
    {
48
        if (!empty($this->response[$index])) {
49
            return $this->response[$index];
50
        }
51
        return null;
52
    }
53
54
    /**
55
     * Return the raw array provided by mandrill
56
     *
57
     * @return array
58
     */
59
    public function toArray()
60
    {
61
        return $this->response;
62
    }
63
}
64