These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * Copyright (C) 2013 Mailgun |
||
7 | * |
||
8 | * This software may be modified and distributed under the terms |
||
9 | * of the MIT license. See the LICENSE file for details. |
||
10 | */ |
||
11 | |||
12 | namespace Mailgun\Model\MailingList; |
||
13 | |||
14 | use Mailgun\Model\ApiResponse; |
||
15 | |||
16 | View Code Duplication | final class DeleteResponse implements ApiResponse |
|
0 ignored issues
–
show
|
|||
17 | { |
||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $message; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $address; |
||
27 | |||
28 | 1 | public static function create(array $data) |
|
29 | { |
||
30 | 1 | $message = isset($data['message']) ? $data['message'] : ''; |
|
31 | 1 | $address = isset($data['address']) ? $data['address'] : ''; |
|
32 | |||
33 | 1 | return new self($address, $message); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * DeleteResponse constructor. |
||
38 | * |
||
39 | * @param string $address |
||
40 | * @param string $message |
||
41 | */ |
||
42 | 1 | private function __construct($address, $message) |
|
43 | { |
||
44 | 1 | $this->address = $address; |
|
45 | 1 | $this->message = $message; |
|
46 | 1 | } |
|
47 | |||
48 | /** |
||
49 | * @return string |
||
50 | */ |
||
51 | 1 | public function getMessage() |
|
52 | { |
||
53 | 1 | return $this->message; |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * @return string |
||
58 | */ |
||
59 | 1 | public function getAddress() |
|
60 | { |
||
61 | 1 | return $this->address; |
|
62 | } |
||
63 | } |
||
64 |
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.