Code Duplication    Length = 28-31 lines in 12 locations

src/Model/MailingList/CreateResponse.php 1 location

@@ 16-43 (lines=28) @@
13
14
use Mailgun\Model\ApiResponse;
15
16
final class CreateResponse implements ApiResponse
17
{
18
    private $message;
19
    private $list;
20
21
    public static function create(array $data): self
22
    {
23
        $model = new self();
24
        $model->list = MailingList::create($data['list']);
25
        $model->message = $data['message'] ?? '';
26
27
        return $model;
28
    }
29
30
    private function __construct()
31
    {
32
    }
33
34
    public function getMessage(): string
35
    {
36
        return $this->message;
37
    }
38
39
    public function getList(): MailingList
40
    {
41
        return $this->list;
42
    }
43
}
44

src/Model/MailingList/DeleteResponse.php 1 location

@@ 16-43 (lines=28) @@
13
14
use Mailgun\Model\ApiResponse;
15
16
final class DeleteResponse implements ApiResponse
17
{
18
    private $message;
19
    private $address;
20
21
    public static function create(array $data): self
22
    {
23
        $model = new self();
24
        $model->address = $data['address'] ?? '';
25
        $model->message = $data['message'] ?? '';
26
27
        return $model;
28
    }
29
30
    private function __construct()
31
    {
32
    }
33
34
    public function getMessage(): string
35
    {
36
        return $this->message;
37
    }
38
39
    public function getAddress(): string
40
    {
41
        return $this->address;
42
    }
43
}
44

src/Model/MailingList/Member/CreateResponse.php 1 location

@@ 16-43 (lines=28) @@
13
14
use Mailgun\Model\ApiResponse;
15
16
final class CreateResponse implements ApiResponse
17
{
18
    private $member;
19
    private $message;
20
21
    public static function create(array $data): self
22
    {
23
        $model = new self();
24
        $model->member = Member::create($data['member']);
25
        $model->message = $data['message'] ?? '';
26
27
        return $model;
28
    }
29
30
    private function __construct()
31
    {
32
    }
33
34
    public function getMember(): Member
35
    {
36
        return $this->member;
37
    }
38
39
    public function getMessage(): string
40
    {
41
        return $this->message;
42
    }
43
}
44

src/Model/MailingList/Member/DeleteResponse.php 1 location

@@ 16-43 (lines=28) @@
13
14
use Mailgun\Model\ApiResponse;
15
16
final class DeleteResponse implements ApiResponse
17
{
18
    private $member;
19
    private $message;
20
21
    public static function create(array $data): self
22
    {
23
        $model = new self();
24
        $model->member = Member::create($data['member']);
25
        $model->message = $data['message'] ?? '';
26
27
        return $model;
28
    }
29
30
    private function __construct()
31
    {
32
    }
33
34
    public function getMember(): Member
35
    {
36
        return $this->member;
37
    }
38
39
    public function getMessage(): string
40
    {
41
        return $this->message;
42
    }
43
}
44

src/Model/MailingList/Member/UpdateResponse.php 1 location

@@ 16-43 (lines=28) @@
13
14
use Mailgun\Model\ApiResponse;
15
16
final class UpdateResponse implements ApiResponse
17
{
18
    private $member;
19
    private $message;
20
21
    public static function create(array $data): self
22
    {
23
        $model = new self();
24
        $model->member = Member::create($data['member']);
25
        $model->message = $data['message'] ?? '';
26
27
        return $model;
28
    }
29
30
    private function __construct()
31
    {
32
    }
33
34
    public function getMember(): Member
35
    {
36
        return $this->member;
37
    }
38
39
    public function getMessage(): string
40
    {
41
        return $this->message;
42
    }
43
}
44

src/Model/MailingList/UpdateResponse.php 1 location

@@ 16-43 (lines=28) @@
13
14
use Mailgun\Model\ApiResponse;
15
16
final class UpdateResponse implements ApiResponse
17
{
18
    private $message;
19
    private $list;
20
21
    public static function create(array $data): self
22
    {
23
        $model = new self();
24
        $model->list = MailingList::create($data['list']);
25
        $model->message = $data['message'] ?? '';
26
27
        return $model;
28
    }
29
30
    private function __construct()
31
    {
32
    }
33
34
    public function getMessage(): string
35
    {
36
        return $this->message;
37
    }
38
39
    public function getList(): MailingList
40
    {
41
        return $this->list;
42
    }
43
}
44

src/Model/Message/SendResponse.php 1 location

@@ 19-46 (lines=28) @@
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class SendResponse implements ApiResponse
20
{
21
    private $id;
22
    private $message;
23
24
    private function __construct()
25
    {
26
    }
27
28
    public static function create(array $data): self
29
    {
30
        $model = new self();
31
        $model->id = $data['id'] ?? '';
32
        $model->message = $data['message'] ?? '';
33
34
        return $model;
35
    }
36
37
    public function getId(): string
38
    {
39
        return $this->id;
40
    }
41
42
    public function getMessage(): string
43
    {
44
        return $this->message;
45
    }
46
}
47

src/Model/Suppression/BaseResponse.php 1 location

@@ 21-48 (lines=28) @@
18
 *
19
 * @author Sean Johnson <[email protected]>
20
 */
21
abstract class BaseResponse implements ApiResponse
22
{
23
    private $address;
24
    private $message;
25
26
    final private function __construct()
27
    {
28
    }
29
30
    public static function create(array $data): self
31
    {
32
        $model = new static();
33
        $model->address = $data['address'] ?? '';
34
        $model->message = $data['message'] ?? '';
35
36
        return $model;
37
    }
38
39
    public function getAddress(): string
40
    {
41
        return $this->address;
42
    }
43
44
    public function getMessage(): string
45
    {
46
        return $this->message;
47
    }
48
}
49

src/Model/Suppression/Whitelist/DeleteResponse.php 1 location

@@ 19-46 (lines=28) @@
16
/**
17
 * @author Artem Bondarenko <[email protected]>
18
 */
19
final class DeleteResponse implements ApiResponse
20
{
21
    private $value;
22
    private $message;
23
24
    final private function __construct()
25
    {
26
    }
27
28
    public static function create(array $data): self
29
    {
30
        $model = new static();
31
        $model->value = $data['value'] ?? '';
32
        $model->message = $data['message'] ?? '';
33
34
        return $model;
35
    }
36
37
    public function getValue(): string
38
    {
39
        return $this->value;
40
    }
41
42
    public function getMessage(): string
43
    {
44
        return $this->message;
45
    }
46
}
47

src/Model/Tag/CountryResponse.php 1 location

@@ 19-49 (lines=31) @@
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class CountryResponse implements ApiResponse
20
{
21
    /**
22
     * @var array [locale => data[]]
23
     */
24
    private $countries;
25
    private $tag;
26
27
    private function __construct()
28
    {
29
    }
30
31
    public static function create(array $data): self
32
    {
33
        $model = new self();
34
        $model->tag = $data['tag'] ?? '';
35
        $model->countries = $data['countries'] ?? [];
36
37
        return $model;
38
    }
39
40
    public function getCountries(): array
41
    {
42
        return $this->countries;
43
    }
44
45
    public function getTag(): string
46
    {
47
        return $this->tag;
48
    }
49
}
50

src/Model/Tag/DeviceResponse.php 1 location

@@ 19-49 (lines=31) @@
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class DeviceResponse implements ApiResponse
20
{
21
    /**
22
     * @var array [name => data[]]
23
     */
24
    private $devices;
25
    private $tag;
26
27
    private function __construct()
28
    {
29
    }
30
31
    public static function create(array $data): self
32
    {
33
        $model = new self();
34
        $model->tag = $data['tag'] ?? '';
35
        $model->devices = $data['devices'] ?? [];
36
37
        return $model;
38
    }
39
40
    public function getDevices(): array
41
    {
42
        return $this->devices;
43
    }
44
45
    public function getTag(): string
46
    {
47
        return $this->tag;
48
    }
49
}
50

src/Model/Tag/ProviderResponse.php 1 location

@@ 19-49 (lines=31) @@
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class ProviderResponse implements ApiResponse
20
{
21
    /**
22
     * @var array [name => data[]]
23
     */
24
    private $providers;
25
    private $tag;
26
27
    private function __construct()
28
    {
29
    }
30
31
    public static function create(array $data): self
32
    {
33
        $model = new self();
34
        $model->tag = $data['tag'] ?? '';
35
        $model->providers = $data['providers'] ?? [];
36
37
        return $model;
38
    }
39
40
    public function getProviders(): array
41
    {
42
        return $this->providers;
43
    }
44
45
    public function getTag(): string
46
    {
47
        return $this->tag;
48
    }
49
}
50