Completed
Push — master ( 4b0611...da5ccd )
by Tobias
06:14 queued 03:25
created

CreateResponse::getList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * Copyright (C) 2013 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Model\MailingList;
11
12
use Mailgun\Model\ApiResponse;
13
14 View Code Duplication
final class CreateResponse implements ApiResponse
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * @var string
18
     */
19
    private $message;
20
21
    /**
22
     * @var MailingList
23
     */
24
    private $list;
25
26
    /**
27
     * @param array $data
28
     *
29
     * @return self
30
     */
31 2
    public static function create(array $data)
32
    {
33 2
        $message = isset($data['message']) ? $data['message'] : '';
34 2
        $list = MailingList::create($data['list']);
35
36 2
        return new self($list, $message);
37
    }
38
39 2
    private function __construct(MailingList $list, $message)
40
    {
41 2
        $this->list = $list;
42 2
        $this->message = $message;
43 2
    }
44
45
    /**
46
     * @return string
47
     */
48 2
    public function getMessage()
49
    {
50 2
        return $this->message;
51
    }
52
53
    /**
54
     * @return MailingList
55
     */
56 2
    public function getList()
57
    {
58 2
        return $this->list;
59
    }
60
}
61