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\Message; |
||
13 | |||
14 | use Mailgun\Model\ApiResponse; |
||
15 | |||
16 | /** |
||
17 | * @author Tobias Nyholm <[email protected]> |
||
18 | */ |
||
19 | final class SendResponse implements ApiResponse |
||
20 | { |
||
21 | private $id; |
||
22 | private $message; |
||
23 | |||
24 | 15 | private function __construct() |
|
25 | { |
||
26 | 15 | } |
|
27 | |||
28 | 15 | View Code Duplication | public static function create(array $data): self |
0 ignored issues
–
show
|
|||
29 | { |
||
30 | 15 | $model = new self(); |
|
31 | 15 | $model->id = $data['id'] ?? ''; |
|
32 | 15 | $model->message = $data['message'] ?? ''; |
|
33 | |||
34 | 15 | return $model; |
|
35 | } |
||
36 | |||
37 | 4 | public function getId(): string |
|
38 | { |
||
39 | 4 | return $this->id; |
|
40 | } |
||
41 | |||
42 | 1 | public function getMessage(): string |
|
43 | { |
||
44 | 1 | return $this->message; |
|
45 | } |
||
46 | } |
||
47 |
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.